View Single Post
  #4 (permalink)  
Old 11-12-09, 07:30 PM
End User's Avatar
End User End User is offline
Level II Curmudgeon
 
Join Date: Dec 2004
Posts: 3,027
Thanks: 14
Thanked 35 Times in 33 Posts
I have this mostly sorted, but I'm now trying to figure out how to add an 'onclick()' event to a dynamically created element:

var y=document.createElement('option');
y.value=tmp1;
y.text=tmp;
y.onclick = moveinid();

I've tried numerous variations on the line in bold, using setAttribute, attachEvent, etc etc and still haven't hit on it. How does one attach an onclick event in this circumstance?
__________________
I don't live on the edge, but sometimes I go there to visit.
-------------------------------------------------------------------------
Sanitize Your Data | Oracle Date & Substring Functions | Code Snippet Library | [url=http://www.codmb.com/Call Of Duty[/url]
Reply With Quote