What's the "official" way to dynamically/programmically change a HTML element's style via ECMAscript? The Rhino book has IE or Netscape versions, and I can't find exactly what I'm looking for at w3.org.
Thanks,
Printable View
What's the "official" way to dynamically/programmically change a HTML element's style via ECMAscript? The Rhino book has IE or Netscape versions, and I can't find exactly what I'm looking for at w3.org.
Thanks,
Yes, this is something of a pain. The Rhino book covers JavaScript, but it is before the standards.
There is a single page that I've found at the W3C that helps (sorta): DOM Level 3 Core Specs Appendix E: ECMAScript Language Binding.
If you have any specific questions, I will try to help.
In the meantime, I hope this helps (and I hope I got all the syntax correct):
Code:var myObject = document.getElementByID("foo");
myObject.style.backgroundColor = "#0000ff";
myObject.style.Color = "#ff0000";
I was looking for a page like this http://www.w3.org/TR/2001/WD-DOM-Lev...1025/html.html for HTML DOM Level 3, but I guess that's not ready yet.
That looks similar to what I was doing, but I wasn't sure whether it was correct or just an IE extension (all I really need to support on my intranet is IE 5/6 anyway, but...)
Thanks,
Yeah, for some reason the standard looks more like the MS extention than the NS originals. *shrug*