you are asking to have the alert() function evaluated and setting the result to the onclick method of the "item" object variable. I think what you want to do is assign a function to that method, like this: item.onclick = function(){ alert('foo'); } ALSO: function myfunction() { alert('foo'); } item.onclick = myfunction; /* assign the function "myfunction" to the onclick method */ On Sun, 6 Nov 2005 15:01:34 -0800 (PST) Anthony Ettinger <apwebdesign at yahoo.com> wrote: > this doesn't seem to work: > > var item = document.getElementById('foo'); > item.onclick = "alert('foo');"; > > http://developer.mozilla.org/en/docs/DOM:element.onclick > > Anthony Ettinger > ph: (408) 656-2473 > web: http://www.apwebdesign.com > _______________________________________________ > Javascript mailing list > Javascript at LaTech.edu > https://lists.LaTech.edu/mailman/listinfo/javascript > > > __________________________________________________________ > This message was scanned by ATX > 4:08:53 AM ET - 11/7/2005