hi, am rather confused as to why my on submit is not firing the function i want it to. anyone know why ?
Code:
<form name="mail" method="post" action="send_form_email.php" >
html
code
goes
here
<input type="submit" value="Submit" onsubmit="Checks()">
</center>
</form>
function Checks() {
if ( age < 24 && age > 20) {
alert("We may be able to insure you, please call us.")};
return false;
if ( age < 21 ) {
alert("You must be over 24 to hire")};
return false;
}
<form name="mail" method="post" action="send_form_email.php" onsubmit="return Checks()">
html
code
goes
here
<input type="submit" value="Submit"></center></form><script type="text/javascript">
function Checks() {
if ( age < 24 && age > 20) {
alert("We may be able to insure you, please call us.");
return false;
}
else if ( age < 21 ) {
alert("You must be over 20 to hire");
return false;
}
}
</script>
I also noticed you made some syntax errors in your javascript. Pay more attention to brackets.
Thank you for all the replys, i will test the code later, also the script is not wrapped in the scripttype tags as it is in a seprate file, i just put it there so you could see the function too. thanks you very much
<form name="mail" method="post" action="send_form_email.php" onsubmit="return Checks()">
html
code
goes
here
<input type="submit" value="Submit"></center></form><script type="text/javascript">
function Checks() {
if ( age < 24 && age > 20) {
alert("We may be able to insure you, please call us.");
return false;
}
else if ( age < 21 ) {
alert("You must be over 20 to hire");
return false;
}
}
</script>
I also noticed you made some syntax errors in your javascript. Pay more attention to brackets.
just tested this and it still wont work, It dosent even fire the function, using google chromes develop tools it just skips over it
Bookmarks