[Javascript] setAttribute or not?

Michael Borchers list at tridemail.de
Wed Nov 28 04:54:16 CST 2007


var select = document.createElement('select');
   

select.name    = 'foo';

OR

select.setAttribute('name', 'foo');


Any (dis-)advantages between those two?

Can I set an event with the first method, like select.onchange = ...,
or does it only work with setAttribute?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20071128/933b08c5/attachment.htm>


More information about the Javascript mailing list