Posted By:
Anonymous
Posted On:
Tuesday, July 8, 2003 07:47 AM
How to register an event handler to a HTML object (dinamically created with javascript), and make it work with Internet Explorer? The next crossbrowser statement creates dinamically a TextArea -> var input = document.createElement("textarea"); Now, to register an event handler to this object could be done as follows: -> input.setAttribute("onClick","alert('Hello');"); But THE PROBLEM is that the previous command only works with Netscape. It doesn't work properly with IE. I've tried doing: -> input.onclick = "alert('Hello');"; and -> input.onclick = clickHandle
More>>
How to register an event handler to a HTML object (dinamically created with javascript), and make it work with Internet Explorer?
The next crossbrowser statement creates dinamically a TextArea
-> var input = document.createElement("textarea");
Now, to register an event handler to this object could be done as follows:
-> input.setAttribute("onClick","alert('Hello');");
But THE PROBLEM is that the previous command only works with Netscape. It doesn't work properly with IE. I've tried doing:
-> input.onclick = "alert('Hello');";
and
-> input.onclick = clickHandle;
function clickHandle {
alert("Hello");
}
.. but it's still not working with IE.
Thanks
<<Less