W3C home > Mailing lists > Public > www-dom@w3.org > October to December 2001

Re: inserting javascript into an element

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Thu, 06 Dec 2001 13:25:19 -0500
Message-Id: <200112061825.NAA04956@no-knife.mit.edu>
To: alex <shortestpath@yahoo.com>
cc: www-dom@w3.org
> var e = document.createElement("select");
> e.setAttribute("onchange", "alert('option changed')");

You want to use addEventListener instead of setAttribute, at a guess.

Boris
-----------------
617-864-9910
-----------------
Ray's Rule of Precision:
   Measure with a micrometer.  Mark with chalk.  Cut
with an axe.
Received on Thursday, 6 December 2001 13:25:24 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:55 GMT