M
mehdi_mousavi
Hi folks,
Consider this html snippet:
<form name='myForm'>
<input type='button' value='go' name='myButton'>
</form>
I need to handle the onclick event of myButton control in javascript.
However, this has to be done without adding the onclick event to the
input tag above. I know there's a notation that lets me do this,
something like this:
<script>
myForm.myButton.onclick = function()
{
alert('this is executed if the user presses mybutton.');
}
</script>
but I cannot remember it exactly. Moreover, I would like to know if
this is W3C compliant.
Any help would be highly appreciated,
Cheers.
Mehdi
Consider this html snippet:
<form name='myForm'>
<input type='button' value='go' name='myButton'>
</form>
I need to handle the onclick event of myButton control in javascript.
However, this has to be done without adding the onclick event to the
input tag above. I know there's a notation that lets me do this,
something like this:
<script>
myForm.myButton.onclick = function()
{
alert('this is executed if the user presses mybutton.');
}
</script>
but I cannot remember it exactly. Moreover, I would like to know if
this is W3C compliant.
Any help would be highly appreciated,
Cheers.
Mehdi