The Dev Pages

A knowledge base for simple (and beyond) web applications development




If you try and set the style attribute of a DOM element with Javascript, the following code WON’T WORK IN IE:

yourelement.setAttribute('style','left:150px; top:150px;');

Instead use:

yourelement.style.cssText = 'left:150px; top:150px;';

Thanks to Rob on this page

http://www.quirksmode.org/bugreports/archives/2005/03/setAttribute_does_not_work_in_IE_when_used_with_th.html

http://blog.throbs.net/

  1. tme Said,

    Sure it won’t work since its Attribute, not Attirbute. 🙂

  2. admin Said,

    Nice catch! I fixed the street jive spelling ‘Attirbute’ to ‘Attribute’.

Add A Comment