Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
12
rated 0 times [  16] [ 4]  / answers: 1 / hits: 21327  / 11 Years ago, thu, march 14, 2013, 12:00:00

The following is the code.



<html>
<head>
<script type=text/javascript>
function call() {
alert(hai);
}
</script>
</head>
<body>
<form name=login method=post action=>
<input type=submit name=Submit value=login onSubmit=call()>
</form>
</body>
</html>


Is it possible to create an event onSubmit inside the input element type button.



This is for an assignment. I was told by my tutor that it is possible. Any help would be highly appreciated.



Thank you.


More From » html

 Answers
3

Your onsubmit should be applied to the form as it's the form that gets submitted - not the button.



From the HTML4 specification:




The onsubmit event occurs when a form is submitted. It only applies to the FORM element.



[#79597] Wednesday, March 13, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
aileent

Total Points: 556
Total Questions: 107
Total Answers: 101

Location: Croatia
Member since Fri, Sep 11, 2020
4 Years ago
;