Reply
Wed 20 Aug, 2014 05:04 am
<html>
<head>
<script>
function validate()
{
if( document.valid.firstname.value == "" )
{
alert( "Please provide your firstName!" );
return false;
}
if( document.valid.middlename.value == "" )
{
alert("please provide your middlename" );
return false;
}
var x = document.valid.email-id.value;
atpos = x.indexOf("@");
dotpos = x.lastIndexOf(".");
if (x == " "||atpos < 1 )
{
alert("Please enter correct email ID")
return false;
}
}
</script>
</head>
<body>
<h1>Validation Form</h1>
<form action="#" name="valid" onsubmit="return(validate());">
Firstname:  <input type="text" name="firstname" placeholder="type your name"/><br>
Middlename:  <input type="text" name="middlename" placeholder="type your name"/><br>
Sex:<input type="radio" name="sex" value="male" checked />Male<br>
<input type="radio" name="sex" value="female"/>Female<br>
Email-Id: <input type="text" name="email-id" size="30"/><br>
Password: <input type="password" name="pwd" maxlength="20"/><br>
Mobile:<input type="text" name="mobile number" id="mobileno" maxlength="10"/>
<input type="submit" value="submit">Submit </input>
</form>
</body>
</html>
please help me as i have made the form & in email code the form is not giving any alert