I am new to Javascript. Recently I am trying to prepare a checkform function, although the function works, IE mentioned the "msg2" at the end was not declared, may experts please teach me how to make it work? Thanks a lot!
function check_si_form_info(form,mark,edit){
if(mark==11 || mark=="all"){
if(form.login.value==""){
si_check_login.innerHTML="Please enter Login Name!";
si_check_login.style.height="auto";
form.login.style.backgroundColor="#FFD5FF";
return false;
}else if (form.login.value!==""){
var loginname = form.login.value;
xmlhttp=new XMLHttpRequest();
xmlhttp.open('get','si/check_si_loginname.php?loginname='+loginname,true);
xmlhttp.onreadystatechange = function(){
if(xmlhttp.readyState == 4){
if(xmlhttp.status == 200){
msg2 = xmlhttp.responseText;
if(msg2 == '2'){
si_check_login.innerHTML="Login name is not available!";
si_check_login.style.height="auto";
form.login.style.backgroundColor="#FFD5FF";
return false;
}else if(msg2 == '1'){
si_check_login.innerHTML="";
si_check_login.style.height="0px";
form.login.style.backgroundColor="#FFFFFF";
}
}//200
}//4
}//onreadystatechange
xmlhttp.send(null);
}
if (msg2 == '2'){
return false;
}
}//11
}