First of all, sorry for bad english.
Well, I need to change the color property of all parragraphs, using javascript, here's my html&JS code:
<body>
<p>Parragraph one</p>
<p>Parragraph two</p>
<button onclick="CE()">change style</button>
</body>
for (var j=0;j<document.styleSheets[0].cssRules.length;j++) {
if(document.styleSheets[0].cssRules[j].selectorText='p')
document.styleSheets[0].cssRules[j].style.color="#FF0000";
}
And this is my CSS code:
p{
color: green;
font-size: 20px;
font-weight: bold;
font-family: arial;
}
I tried to change it with this too: document.styleSheets[0].cssRules[0].style.backgroundColor="#FF0000"
;
(trying to change the background color, just to see if it works, but only works on Mozilla Firefox)