I want to write a generic clearForm function to clear the form when
the user click CLEAR button.
Here's my attempts, because I want to take care all html controls. I
think I need to test
if the control is submit button, regular button. But I don't know
what I should do on drop down box?
function clearForm()
{ var i=0;
for (i=0; i<InputForm.ele ments.length-1; i++)
{ var obj = InputForm.eleme nts[i];
document.write( obj.type); //runtime error: object doesn't support
this property or method
if (obj.type != "submit" && obj.type != "button")
obj.value = "";
}
}
any ideas?? thanks!!
the user click CLEAR button.
Here's my attempts, because I want to take care all html controls. I
think I need to test
if the control is submit button, regular button. But I don't know
what I should do on drop down box?
function clearForm()
{ var i=0;
for (i=0; i<InputForm.ele ments.length-1; i++)
{ var obj = InputForm.eleme nts[i];
document.write( obj.type); //runtime error: object doesn't support
this property or method
if (obj.type != "submit" && obj.type != "button")
obj.value = "";
}
}
any ideas?? thanks!!
Comment