[Javascript] DOM: adding CSS to created DIV
Michael Borchers
list at tridemail.de
Mon Jan 22 02:24:02 CST 2007
The first version works fine for FF, but not for IE.
The second one works fine for both.
var entryLayer = document.createElement('DIV');
entryLayer.setAttribute('id','calendarEntryFormLayer');
// FF, not IE:
entryLayer.setAttribute('style','position:absolute;left:200px;top:300px;width:100px;height:100px;background-color:#ffffff;color:#ffffff;;border:1px
solid #0b234c;padding-left:10px;z-index:3000;display:block;');
// both:
entryLayer.style.cssText =
'position:absolute;left:200px;top:300px;width:100px;height:100px;background-color:#ffffff;color:#ffffff;;border:1px
solid #0b234c;padding-left:10px;z-index:3000;display:block;';
document.body.appendChild(entryLayer);
any reason?
More information about the Javascript
mailing list