Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Javascript] DOM: adding CSS to created DIV


  • From: david at dorward.me.uk (David Dorward)
  • Subject: [Javascript] DOM: adding CSS to created DIV
  • Date: Mon Jan 22 02:35:29 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