document.getElementById("myid").style.cssText="font-size:20px;font-weight:bold;"
This method works for both IE (tested in IE6,IE7) and Firefox (ver 3.6).
Note that you actually replaces the old style with your new style using this method.
To add style to existing styles do this
document.getElementById("myid").style.cssText +="color:red"
I noticed that IE7 does not add new style element to the existing style if you don't prepend a ";"
Note that it still replaces the old style if the added element already exists.
No comments:
Post a Comment