P
puneet.kandhari
The following code
used with
<input type="text" name="username" id="username" onblur="javascript:
return checkAlphanumeric('username','Error: Please enter Alpha Numeric
only only.','username_error');"/>
always crashes IE and i dont see why.
help
Code:
function checkAlphanumeric(field,msg,errorspan){
var alphanmuer= /^[A-Za-z][-A-Za-z0-9_ ]{0,49}$/;
var strValue = document.getElementById(field).value;
if(strValue.length>1){
if (strValue.search(alphanmuer)!=-1) {
document.getElementById(errorspan).innerHTML = '';
return;
}
else{
document.getElementById(errorspan).innerHTML = msg;
document.getElementById(field).focus();
document.getElementById(field).select();
return;
}
}
else{
document.getElementById(errorspan).innerHTML = msg;
document.getElementById(field).focus();
document.getElementById(field).select();
return;
}
}
used with
<input type="text" name="username" id="username" onblur="javascript:
return checkAlphanumeric('username','Error: Please enter Alpha Numeric
only only.','username_error');"/>
always crashes IE and i dont see why.
help