Suppose you have a form and you wish to alter the form's onsubmit event handler on-the-fly...
For example, your form might consists of two radio buttons and a submit button. Depending on which radio button has been selected prior to the user's submitting the form, you want the onsubmit event handler to change.
This works in Firefox, but not IE:
form.setAttribute("onSubmit", "alert('hi'); return false;");
This works in both:
frm.onsubmit=test;
function test() {
alert('hi');
return false;
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment