How can I dynamically assign an event to an element?
I have tried :
(myelement is a text input)
document.getEle mentById('myele ment').onKeyUp =
"myfnc(param1,p aram2,param3)";
document.getEle mentById('myele ment')[onKeyUp] = new
Function("myfnc (param1,param2, param3)");
document.getEle mentById('myele ment').onKeyUp = new
Function("myfnc (param1,param2, param3)");
None of these work. :(
Can someone please show my how to do this? (if the syntax is different for
IE and NS, please show me both)
Thanks!
-Eric
I have tried :
(myelement is a text input)
document.getEle mentById('myele ment').onKeyUp =
"myfnc(param1,p aram2,param3)";
document.getEle mentById('myele ment')[onKeyUp] = new
Function("myfnc (param1,param2, param3)");
document.getEle mentById('myele ment').onKeyUp = new
Function("myfnc (param1,param2, param3)");
None of these work. :(
Can someone please show my how to do this? (if the syntax is different for
IE and NS, please show me both)
Thanks!
-Eric
Comment