Javascript Example
Screen shot
Screen shot
Javascript code to validate Blank field
<html>
<head>
<title>Javascript Blank Field Validation</title>
<script language=\"javascript\">
function validate()
{
if(document.frm.name.value==\'\')
{
alert(\"Please Enter Name\");
document.frm.name.focus();
return false;
}
return true;
}
</script>
</head>
<body>
<form name=\"frm\" action=\"\" method=\"post\" onSubmit=\"return validate()\">
<table border=\"1\" align=\"center\">
<tr>
<td>Enter Name</td>
<td><input name=\"name\" type=\"text\"></td>
</tr>
<td colspan=\"2\">
<input name=\"btnsubmit\" type=\"submit\" value=\"Submit\">
</td>
</tr>
</table>
</form>
</body>
</html>
You can download source code here