[thelist] DOM in IE

Christian Heilmann codepo8 at gmail.com
Wed May 23 18:10:32 CDT 2007

> In order to dinamically create a user-defined number of lines (with
> input text in each line) in a table I used DOM. Everything works fine
> in Firefox, however, in Internet Explorer:
> frmnam = document.createElement('input');
> frmnam.setAttribute('class','formbranco');
> The setAttribute does not work, as the new input's end up with no style.
> I tried google but this seems difficult to sort out.

class is a reserved word and can therefore not be an attribute.
frmnam.className = 'formbranco'; is what you need to use.

Chris Heilmann
Book: http://www.beginningjavascript.com
Blog: http://www.wait-till-i.com
Writing: http://icant.co.uk/

More information about the thelist mailing list