cssRules in IE

  • Thread starter Christopher Benson-Manica
  • Start date
C

Christopher Benson-Manica

Supposedly IE implements the cssRules property for a stylesheet. So
why is the word 'foo' in the below page red and not blue?

<html>
<head>
<style>
.foo { color: #ff0000; }
</style>
</head>
<body>
<span class="foo">foo</span>
<script type="text/javascript">
document.styleSheets[0].cssRules[0].style.color='#0000ff';
</script>
</body></html>
 
E

Evertjan.

Christopher Benson-Manica wrote on 03 mrt 2005 in comp.lang.javascript:
Supposedly IE implements the cssRules property for a stylesheet. So
why is the word 'foo' in the below page red and not blue?

<html>
<head>
<style>
.foo { color: #ff0000; }
</style>
</head>
<body>
<span class="foo">foo</span>
<script type="text/javascript">
document.styleSheets[0].cssRules[0].style.color='#0000ff';
</script>
</body></html>

IE uses rules[]

document.styleSheets[0].rules[0].style.color='#0000ff';
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,040
Latest member
papereejit

Latest Threads

Top