<form name='form1' action='javascript_validation-demo.php' method='post' onSubmit='return validate();'>
Input :<input type=text name=textinput value=''> <br>
<div id='my_msg'>Submit the form by clicking the button.</div><br>
<input type=submit value=submit>
</form>
JavaScript
<script language="JavaScript" type="text/JavaScript">
<!--
function validate() {
if(document.form1.textinput.value=="")
{
document.getElementById('my_msg').innerHTML=" Fill the text box before submitting ";
///alert("Fill the Input box before submitting.");
return false;
}
else {
return true;
}
}
//-->
</SCRIPT>