minimum 1 special charactor
min limit 6 max limit 10
HTML
<label for="password"> password</label>
<input name="password" type="text" id="password" onblur="chkit();" maxlength="10" />
Java Script
function chkit()
{
var password=document.getElementById('password').value;
var pattern=/^([a-z A-Z 0-9 - _ . @ # ]*[- _ . @ # ][a-z A-Z 0-9 - _ . @ # ]*)$/;
if(password!="")
{
if(password.length>5)
{
if(!pattern.test(password))
{
alert('pw not in format');
}
else
{
alert('pw In format');
}
}
else
{
alert('pw not In format');
}
}
}
Live Demo
min limit 6 max limit 10
HTML
<label for="password"> password</label>
<input name="password" type="text" id="password" onblur="chkit();" maxlength="10" />
Java Script
function chkit()
{
var password=document.getElementById('password').value;
var pattern=/^([a-z A-Z 0-9 - _ . @ # ]*[- _ . @ # ][a-z A-Z 0-9 - _ . @ # ]*)$/;
if(password!="")
{
if(password.length>5)
{
if(!pattern.test(password))
{
alert('pw not in format');
}
else
{
alert('pw In format');
}
}
else
{
alert('pw not In format');
}
}
}
Live Demo
No comments:
Post a Comment