Hi everyone ,
I was testing the following piece of code and unable to proceed because
the click() method is not invoked for the button's onclick event.
The same function works fine in the onload of the body tag. Moreover the code doesnt work in IE,Opera,Firefo x. There are only four lines and simple HTML statements but I am unable to find a reason.Can someone
spot me the error that I have done here ?
I was testing the following piece of code and unable to proceed because
the click() method is not invoked for the button's onclick event.
The same function works fine in the onload of the body tag. Moreover the code doesnt work in IE,Opera,Firefo x. There are only four lines and simple HTML statements but I am unable to find a reason.Can someone
spot me the error that I have done here ?
Code:
<html>
<head><title>Test page</title>
</head>
<body>
<form name="form1">
<INPUT TYPE="button" NAME="myButton" VALUE="Press This" onClick="click()">
</form>
<script>
function click(){
alert('Hi');
}
</script>
</body>
</html>
Comment