[Javascript] DOM: adding CSS to created DIV

Michael Borchers list at tridemail.de
Mon Jan 22 02:42:29 CST 2007



> On Mon, Jan 22, 2007 at 09:24:02AM +0100, Michael Borchers wrote:
>> The first version works fine for FF, but not for IE.
>
>> 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;');
>
>> any reason?
>
> Internet Explorer's implementation of setAttribute is very broken.
>
> I suspect it looks something like this:
>
> function (attribute, value) {
>  element[attribute] = value;
> }
>
> ... so if the HTML attribute syntax is different from the accessor
> property (as style is) or if the property and attribute names are
> different (class/className) then it breaks.
>
> -- 
> David Dorward                                      http://dorward.me.uk

So .style.cssText will always work fine? 




More information about the Javascript mailing list