Modify CSS problems
| Newsgroups | gmane.comp.mozilla.devel.dom |
|---|---|
| Organization | http://groups.google.com |
| Message-ID | <25f40273-ba81-4bd4-add2-9facbfa4e158@f13g2000yqj.googlegroups.com> |
Hi,
I have this code in a HTML page
<p>
One<p>Two</p>
Three
</p>
And I'm trying to change de CSS properties with javascript. I use this
code for do this:
p=document.getElementsByTagName('p');
for (var i = 0; i < p.length; i++) {
p.item(i).setAttribute("style", "background:peachpuff; border-
top:solid orange;
border-bottom:solid orange;font-family:Arial; font-size:
10px");
}
And the problem is that the css style only applies to the text 'One'
and 'Two', but the text 'Three' apeareance is not modified.
What is the problem? My code is wrong?
Many Thanks. Sorry for my bad english