Hi,
This is the code for form validation to check whether the username has six characters.i'm getting error.In form element i have added action="registration.aspx" i think it is for validaiton in server.. wat is the purpose of it???
can anyone pls suggest free links for webdeveloping ebooks using javascript?. how jquery is related to javascript? How to build online buying websites???
<!DOcTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>first java script example</title>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
<script type="text/javascript">
function validate(form)
{
var returnValue=true;
var username=frmRegister.txtUserName.value;
var password1=frmRegister.txtPassword1.value;
var password2=frmRegister.txtPassword2.value;
if(username.length < 6)
{
returnValue=false;
alert("your username must be atelast six characters");
frmRegister.txtUserName.focus();
}
return returnValue;
</script>
<body>
<form name="frmRegister" method="post" action="register.aspx" onsubmit="return validate(this);">
<div class="label"><label for="txtUsername">username:</label></div>
<div class="formElement">
<input type="text" name="txtUsername" id="txtUserName" size="12" />
</div>
<div class="label"><label for="txtPassword">password:</td></label></div>
<div class="formElement">
<input type="password" name="txtUserName id="txtPassword" size="12" />
</div>
<div class="formElement"><input type="submit" value="login" /></div>
</form>
</body>
</html>
thanks for ur time