通过Javascript(Jscript)访问伪类 [英] Accessing pseudo-classes through Javascript (Jscript)

查看:55
本文介绍了通过Javascript(Jscript)访问伪类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,


有没有办法操纵或至少读取

元素的伪类?

我知道可以访问style属性并为特定元素提供CSS属性

。但是,我似乎无法访问悬停

属性。


例如:


..class {color:#aaaaaa}

..class:hover {}


< div id =" test" class =" class">< / div>


然后在理想的世界中,我想做以下事情:


function()

{

element = $(''test'')

element.style.hover.color = #aaaaaa ; < --------这不起作用

}

Hello,

Is there a way to manipulate or at least read the pseudo-class of an
element ?

I know the style attribute can be accessed and gives the CSS properties
for a particular element. However, I can''t seem to access the "hover"
properties.

example :

..class { color:#aaaaaa }
..class:hover {}

<div id="test" class="class"></div>

And then in an ideal world, I would like to do the following :

function()
{
element = $(''test'')
element.style.hover.color = #aaaaaa; <-------- this does not work
}

推荐答案

('' 'test'')

element.style.hover.color = #aaaaaa; < --------这不起作用

}

(''test'')
element.style.hover.color = #aaaaaa; <-------- this does not work
}


pochartrand在5/29上说了以下内容/ 2006 11:55 AM:
pochartrand said the following on 5/29/2006 11:55 AM:
你好,

有没有办法操纵或至少读取
元素的伪类?


也许。

我知道可以访问style属性并为特定元素提供CSS属性。但是,我似乎无法访问悬停
属性。

例如:

..class {color:#aaaaaa}
..class:hover {}

< div id =" test" class =" class">< / div>

然后在理想的世界中,我想做以下事情:

function()
{
element =
Hello,

Is there a way to manipulate or at least read the pseudo-class of an
element ?
Perhaps.
I know the style attribute can be accessed and gives the CSS properties
for a particular element. However, I can''t seem to access the "hover"
properties.

example :

..class { color:#aaaaaa }
..class:hover {}

<div id="test" class="class"></div>

And then in an ideal world, I would like to do the following :

function()
{
element =


(''test'')




请告诉我你不是使用prototype.js作为



Please tell me you aren''t using prototype.js as


这篇关于通过Javascript(Jscript)访问伪类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆