30)Write a JavaScript code for accepting user name and password (use validations). Required Validations are : User name text field should not accept numbers, special characters, alphanumeric characters, length should be 20 characters. Password text field length should not be less than 3 characters.

<TITLE> username and password</TITLE>

<H1> username</H1>
<FORM name=”ff”>
User Name :
<INPUT Type=”Text” name=”TxtUser” id=”TxtUserName”><br>
Password :
<INPUT Type=”Password” name=”TxtPass” id=”TxtUserName”><br>

<INPUT Type=”Button” name=”check” value=”check” onClick=”Check(TxtUser.value,TxtPass.value)”><br>

function Check(x,y)
//alert(“Leave from userName”);
var user=x;
var pass=y;
alert(“Blank is not allowed”);
if(user>=’A’ && user<=’Z’)
alert(“Right userName”);
else if(user>=’a’ && user<=’z’)
alert(“Right userName”);
alert(“Wrong userName”);

alert(“Blank is not allowed”);
alert(“correct password”);


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s