Client Side Scripts for Validating Web Form Controls using DHTML in JavaScript

<html>

<head>

<title>A Simple Form with JavaScript Validation</title>

<script type="text/javascript">

<!--

function validate_form ( )
{
valid = true;

if ( document.contact_form.contact_name.value == "" )
{
alert ( "Please fill in the 'Your Name' box." );
valid = false;
}

return valid;

}

//-->

</script>

</head>

<body bgcolor="#FFFFFF">

<form name="contact_form" method="post"
action="/cgi-bin/articles/development/javascript/form-validation-with-javascript/
contact_simple.cgi"
onSubmit="return validate_form ( );">

Please Enter Your Name

<p>Your Name: <input type="text" name="contact_name"></p> <p><input type="submit" name="send" value="Send Details"></p> </form> </body> </html>