Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
<html>
<body>
<script>
function validateform(){
var name=document.myform.name.value;
var password=document.myform.password.value;

if(name == null ||name = ""){
alert("Not be blank");
return false;
}
else
if(password.length<6)
{
alert("must be at least 6 characters");
return false;
}
}
</script>

<form name = "myform" method = "post" onsubmit = "return validateform()">
Name : <input type = "text" name = "name">

Password : <input type = "password" name = "password">

<input type = "submit" value = "Register">
</form>

</body>
</html>
Posted
Comments
Khan Sameer 21-Dec-15 2:11am    
what is the error and where is the problem
deepankarbhatnagar 21-Dec-15 2:34am    
PLease explain where you have problem in your code?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900