deadpool42
Programmer
- May 24, 2004
- 40
I want to insert some code into the onClick event of various form elements. The problem is that the form is being generated by something else, so I can't just put an onClick attribute into the appropriate tags. I seem to remember being able to do this, but when I use this code,
the alert appears when the page loads and not when you click the element.
Code:
document.form.element.onClick = alert("test");
the alert appears when the page loads and not when you click the element.