W
w i l l
Why does this work the way it does?
If someone could explain return true, and return false to me I'd
greatly appreciate it.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Form.html</title>
</head>
<body>
<script language="JavaScript">
function form1_onsubmit() {
var returnValue = false;
if (document.form1.txtName.value == "") {
alert("Please Enter your Name");
document.form1.txtName.focus();
}
else {
returnValue = true;
}
return returnValue;
}
</script>
<form action="formhandler.asp" method="post" name="form1" onSubmit="
return form1_onsubmit()">
name: <input type="text" name="txtName">
<input type="submit" value="Go">
</form>
</body>
</html>
w i l l
If someone could explain return true, and return false to me I'd
greatly appreciate it.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Form.html</title>
</head>
<body>
<script language="JavaScript">
function form1_onsubmit() {
var returnValue = false;
if (document.form1.txtName.value == "") {
alert("Please Enter your Name");
document.form1.txtName.focus();
}
else {
returnValue = true;
}
return returnValue;
}
</script>
<form action="formhandler.asp" method="post" name="form1" onSubmit="
return form1_onsubmit()">
name: <input type="text" name="txtName">
<input type="submit" value="Go">
</form>
</body>
</html>
w i l l