0
   

forms problem

 
 
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:&nbsp&nbsp<input type="text" name="firstname" placeholder="type your name"/><br>
Middlename:&nbsp <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
  • Topic Stats
  • Top Replies
  • Link to this Topic
Type: Question • Score: 0 • Views: 474 • Replies: 0
No top replies

 
 

Related Topics

 
  1. Forums
  2. » forms problem
Copyright © 2024 MadLab, LLC :: Terms of Service :: Privacy Policy :: Page generated in 0.03 seconds on 05/02/2024 at 04:19:47