通过Javascript(Jscript)访问伪类 [英] Accessing pseudo-classes through 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屋!