// JScript 文件 function GetObjs(objName){ if(document.getElementsByName) { return eval('document.getElementsByName("' + objName + '")'); } else{ return null; } } function GetObj(objName){ if(document.getElementById) { return eval('document.getElementById("' + objName + '")'); } else if(document.layers) { return eval("document.layers['" + objName +"']"); } else{ return eval('document.all.' + objName); } } function EmailCheckResult(xdoc){ if (xdoc){ if (xdoc=="0"){ GetObj("email_err").innerHTML="This email is available."; GetObj("email_err").className="noteGre"; } else{ GetObj("email_err").innerHTML="This email has been used."; GetObj("email_err").className="noteRed"; //userObj.value=""; } } } var userObj; function OnEmailTextBoxChange(obj){ var msg=""; var regEx; var regRe; var str; regEx=/^([0-9a-zA-Z_\.-]+)([0-9a-zA-Z_-]+)@([0-9a-zA-Z-]+)\.([0-9a-zA-Z-]+)([a-zA-Z\.]*)([a-zA-Z])$/; str=GetObj("email").value; regRe=str.match(regEx); if (!regRe){ if (str.length==0){ msg+="Please enter your email address.
"; } else{ msg+="The email address you entered is incorrect.
"; } } else if(getLeftChars(str,50) < 0) { msg+="The email address you entered is incorrect,must no more than 50 characters.
"; } if (msg!=""){ GetObj("email_err").innerHTML=msg; GetObj("email_err").className="noteRed"; return; }else{ GetObj("email_err").className=""; } userObj=obj; var objv=obj.value; getData_Text("RegCheckUser.aspx","GET","user="+objv+"&chk=email","EmailCheckResult"); } function getLeftChars(varField,limit_len) { var i = 0; var counter = 0; var cap = limit_len; var j=0; for (i = 0; i< varField.length; i++) { if (varField.charCodeAt(i) > 127 || varField.charCodeAt(i) == 94||varField.charCodeAt(i) < 0) { j=j+2; } else { j=j+1 } } //结束FOR循环 //var leftchars = cap - varField.value.length; var leftchars = cap - j; return (leftchars); } //function CheckFormPassword(){ // var str=GetObj("password").value; // if (str.length<6){ // InnerErr("password","Password must no less than 6 .
"); // return false; // }else{ // InnerErr("password",""); // } // if (str!=GetObj("password2").value){ // InnerErr("password2","Two passwords are not matching.
"); // return false; // }else{ // InnerErr("password2",""); // } // return true; //} //function CheckFormPassword2(){ // var str=GetObj("password").value; // if (str!=GetObj("password2").value){ // InnerErr("password2","Two passwords are not matching.
"); // return false; // }else{ // InnerErr("password2",""); // } // return true; //} //function CheckFormEmail(){ // var regEx=/^([0-9a-zA-Z_\.-]+)([0-9a-zA-Z_-]+)@([0-9a-zA-Z-]+)\.([0-9a-zA-Z-]+)([a-zA-Z\.]*)([a-zA-Z])$/; // var str=GetObj("email").value; // var regRe=str.match(regEx); // if (!regRe){ // if (str.length==0){ // InnerErr("email","Please enter your email address.
"); // return false; // } // else{ // InnerErr("email","The email address you entered is incorrect.
"); // return false; // } // } // else if(getLeftChars(str,50) < 0) // { // InnerErr("email","The email address you entered is incorrect,must no more than 50 characters.
"); // return false; // }else{ // InnerErr("email",""); // } // return true; //} function CheckFormFun(){ var msg=""; var regEx; var regRe; var str; //-- email regEx=/^([0-9a-zA-Z_\.-]+)([0-9a-zA-Z_-]+)@([0-9a-zA-Z-]+)\.([0-9a-zA-Z-]+)([a-zA-Z\.]*)([a-zA-Z])$/; str=GetObj("email").value; regRe=str.match(regEx); if (!regRe){ if (str.length==0){ msg+="Please enter your email address.
"; InnerErr("email","Please enter your email address.
","noteRed"); } else{ msg+="The email address you entered is incorrect.
"; InnerErr("email","The email address you entered is incorrect.
","noteRed"); } } else if(getLeftChars(str,50) < 0) { msg+="The email address you entered is incorrect,must no more than 50 characters.
"; InnerErr("email","The email address you entered is incorrect,must no more than 50 characters.
","noteRed"); } //password if (GetObj("password")){ str=GetObj("password").value; if (str.length<6){ msg+="Password must no less than 6 .
"; GetObj("password").focus(); GetObj("password").select(); InnerErr("password","Password must no less than 6 .
","noteRed"); }else{ InnerErr("password","",""); } if (str!=GetObj("password2").value){ msg+="Two passwords are not matching.
"; GetObj("password2").focus(); GetObj("password2").select(); InnerErr("password2","Two passwords are not matching.
","noteRed"); }else{ InnerErr("password2","",""); } } //customercompany if (GetObjs("userType")[0].checked && (getLeftChars( GetObj("customercompany").value,50) < 0||getLeftChars( GetObj("customercompany").value,50) > 46)){ msg+="Company name is incorrect, can't less than 4 bytes and no more than 50 bytes.
"; InnerErr("customercompany","Company name is incorrect, can't less than 4 bytes and no more than 50 bytes.
","noteRed"); }else{ InnerErr("customercompany","",""); } regEx=/^([\S ]+)$/; str=GetObj("customerrealname").value; regRe=str.match(regEx); if (!regRe){ if (str.length==0){ msg+="Please enter contact name.
"; InnerErr("customerrealname","Please enter contact name.
","noteRed"); } GetObj("customerrealname").focus(); GetObj("customerrealname").select(); } else if(getLeftChars(str,50) < 0) { msg+="The contact name you entered is incorrect, max. 50 bytes.
"; InnerErr("customerrealname","The contact name you entered is incorrect, max. 50 bytes.
","noteRed"); GetObj("customerrealname").focus(); GetObj("customerrealname").select(); }else{ InnerErr("customerrealname","",""); } regEx=/^([\d]{1,9})([\d -]*)([\d]+)$/; str=GetObj("tel").value; regRe=str.match(regEx); if (!regRe){ if (str.length==0){ msg+="Please enter your phone number.
"; InnerErr("tel","Please enter your phone number.
","noteRed"); } else{ msg+="The phone number you entered is incorrect (0571-88888888/13900000000).
"; InnerErr("tel","The phone number you entered is incorrect (0571-88888888/13900000000).
","noteRed"); } GetObj("tel").focus(); GetObj("tel").select(); }else{ InnerErr("tel","",""); } regEx=/^([\d]{1,9})([\d -]*)([\d]+)$/; str=GetObj("fax").value; regRe=str.match(regEx); if (GetObjs("userType")[0].checked &&!regRe){ msg+="The fax number you entered is incorrect(0571-88888888/13900000000).
"; InnerErr("fax","The fax number you entered is incorrect(0571-88888888/13900000000).
","noteRed"); GetObj("fax").focus(); GetObj("fax").select(); }else{ InnerErr("fax","",""); } if (GetObj("selectArea_1").value.length==0|| GetObj("selectArea_2").value.length==0|| GetObj("selectArea_3").value.length==0){ msg+="Please select your country.
"; InnerErr("selectArea_1","Please select your country.
","noteRed"); //GetObj("selectArea_1").focus(); }else{ InnerErr("selectArea_1","",""); } if (GetObj("address").value.length<5 || getLeftChars( GetObj("address").value,100) < 0){ msg+="The address is incorrect, must no less than 5 characters and no more than 100 characters.
"; InnerErr("address","The address is incorrect, must no less than 5 characters and no more than 100 characters.
","noteRed"); GetObj("address").focus(); GetObj("address").select(); } else{ InnerErr("address","",""); } regEx=/^([\dA-Za-z]{1,9})([\dA-Za-z- ]*)$/; str=GetObj("areacode").value; regRe=str.match(regEx); if (!regRe){ if (str.length==0){ msg+="Please enter the postcode.
"; InnerErr("areacode","Please enter the postcode.
","noteRed"); } else{ msg+="The postcode you entered is incorrect.
"; InnerErr("areacode","The postcode you entered is incorrect.
","noteRed"); } GetObj("areacode").focus(); GetObj("areacode").select(); } else{ InnerErr("areacode","",""); } //checkcode if (GetObj("checkcode")){ regEx=/^([\dA-Z#]{4})$/; str=GetObj("checkcode").value; regRe=str.match(regEx); if (!regRe){ if (str.length==0){ msg+="Please enter the valid code.
"; InnerErr("checkcode","Please enter the valid code.
","noteRed"); } else{ msg+="The valid code you entered is incorrect.
"; InnerErr("checkcode","The valid code you entered is incorrect.
","noteRed"); } GetObj("checkcode").focus(); GetObj("checkcode").select(); }else{ InnerErr("checkcode","",""); } } if (GetObj("readed")) if (!GetObj("readed").checked){ msg+="Please reade DNBIZ agreement.
"; InnerErr("readed","Please reade DNBIZ agreement.
","noteRed"); GetObj("readed").focus(); GetObj("readed").select(); } else{ InnerErr("readed","",""); } if (msg!=""){ return false; } } function InnerErr(objName,text,classname){ GetObj(objName+"_err").innerHTML=text; GetObj(objName+"_err").className=classname; } function CheckSignFormFun(){ var msg=""; var regEx; var regRe; var str; //-- username regEx=/^([0-9a-zA-Z]+)([0-9a-zA-Z_-]*)([0-9a-zA-Z]+)$/; str=GetObj("username").value; regRe=str.match(regEx); if (!regRe){ if (str.length==0) msg+="Please enter your username.
"; else if(str.length<3||str.length>10){ msg+="The username you entered is incorrect(only 3-10 characters).
"; } else{ msg+="The username you entered is incorrect(only letters,numerals _ - , fist and last can't be _-).
"; } GetObj("username").focus(); } //password str=GetObj("password").value; if (str.length<6){ msg+="Password must no less than 6 .
"; GetObj("password").focus(); } //checkcode regEx=/^([\dA-Z#]{4})$/; str=GetObj("checkcode").value; regRe=str.match(regEx); if (!regRe){ if (str.length==0) msg+="Please enter the valid code.
"; else{ msg+="The valid code you entered is incorrect.
"; } GetObj("checkcode").focus(); } if (msg!=""){ alert(msg); return false; } } //用户修改密码验证 function CheckModifyPasswordFormFun(){ var msg=""; var regEx; var regRe; var str; //-- username regEx=/^([0-9a-zA-Z]+)([0-9a-zA-Z_-]*)([0-9a-zA-Z]+)$/; //oldpassword str=GetObj("oldpwd").value; if (str.length<6){ msg+="Please enter your old password(6 characters at least).
"; GetObj("oldpwd").focus(); } //newpassword str=GetObj("password").value; if (str.length<6){ msg+="Please enter your new password(6 characters at least).
"; GetObj("password").focus(); } if (str!=GetObj("password1").value){ msg+="Two passwords are not matching.
"; GetObj("password1").focus(); } if (msg!=""){ //alert(msg); GetObj("ErrShow").style.display="block"; GetObj("ErrShow").innerHTML=msg; return false; } } //用户信息修改 function CheckUserDetailedFormFun(){ var msg=""; var regEx; var regRe; var str; //-- email regEx=/^([0-9a-zA-Z_\.-]+)([0-9a-zA-Z_-]+)@([0-9a-zA-Z-]+)\.([0-9a-zA-Z-]+)([a-zA-Z\.]*)([a-zA-Z])$/; str=GetObj("TextBox_Email").value; regRe=str.match(regEx); if (!regRe){ if (str.length==0) msg+="Please enter your email address.
"; else{ msg+="The email address you entered is incorrect.
"; } GetObj("TextBox_Email").focus(); } //customercompany regEx=/^([\S]+)$/; str=GetObj("TextBox_Contact").value; regRe=str.match(regEx); if (!regRe){ if (str.length==0) msg+="Please enter contact name.
"; else{ msg+="The contact name you entered is incorrect, max. 50 bytes.
"; } GetObj("TextBox_Contact").focus(); } regEx=/^([\d]{1,9})([\d -]*)([\d]+)$/; str=GetObj("TextBox_Tel").value; regRe=str.match(regEx); if (!regRe){ if (str.length==0) msg+="Please enter your phone number.
"; else{ msg+="The phone number you entered is incorrect (0571-88888888/13900000000).
"; } GetObj("TextBox_Tel").focus(); } regEx=/^([\d]{1,9})([\d -]*)([\d]+)$/; str=GetObj("TextBox_Fax").value; regRe=str.match(regEx); if (!regRe &&str.length!=0){ msg+="The fax number you entered is incorrect(0571-88888888/13900000000).
"; GetObj("TextBox_Fax").focus(); } if (GetObj("TextBox_Address").value.length<5){ msg+="The address is incorrect, must no less than 5 characters and no more than 100 characters.
"; GetObj("TextBox_Address").focus(); } regEx=/^([\dA-Za-z]{1,9})([\dA-Za-z- ]*)$/; str=GetObj("TextBox_Post").value; regRe=str.match(regEx); if (!regRe){ if (str.length==0) msg+="Please enter the postcode.
"; else{ msg+="The postcode you entered is incorrect.
"; } GetObj("TextBox_Post").focus(); } if (msg!=""){ if (GetObj("ErrShowDefault")) GetObj("ErrShowDefault").style.display="none"; GetObj("ErrShow").innerHTML=msg; GetObj("ErrShow").style.display="block"; return false; } }