<pre name="code" class="html">var time=new Date().getHours();
document.write(Date());
<html>
<head>
<meta name="keywords" content="validate forms"/>
<link rel="stylesheet" type="text/css" href="c1.css" />
</head>
<body>
<form action="submitPage.html" method="post" οnsubmit="return validate_form(this);">
Your Email is
<input type="text" id="emailsff" name="email" size="30"></input>
<input type="submit" value="Submit"></input>
<p id="message"></p>
</form>
<script type="text/javascript">
function validate_email(field,alerttxt){
with(field){
apos=value.indexOf("@");
dotpos=value.indexOf(".");
var y=apos+" and "+dotpos;
alert(y);
if(apos<1||apos-apos<2){
alert(alerttxt);
return false;
}else{
return true;
}
}
}
function validate_form(thisform){
with(thisform){
if(validate_email(email,"this is not valid")==false){
email.focus();
return false;
}
}
}
</script>
</body>
</html>