by MYLE
3. August 2010 21:12
Ever want to check a text feild on a web site and not let you got to the next step
I have to text feilds fd_password and repassword they must be the same
function checkPass(){
var guess = document.myform.fd_password.value;
var secret = document.myform.repassword.value;
if (guess == secret){
} else {
alert("Please check Passwords");
setTimeout("focusElement('myform','repassword')", 0);
}
}
function focusElement(formName, elemName)
{
var elem = document.forms[formName].elements[elemName];
elem.focus();
elem.select();
}
this will keep focus the repassword feild until it the same
Then in the onblur of the feild to check put this
onBlur="checkPass()"
4b570f74-8c1d-4157-9ea9-8f8b40cb25e8|0|.0
Category: Javascript
Tags: focus()