📄 longhua.js
字号:
/*
showMsg()函数主要用来当客户注册时,显示提示
hideMsg()函数主要用来隐藏注册提示的,
而函数checkUserRegName()主要是用来检查客户的账号是否已经被占用
*/
function showMsg(showId){
if(showId =='userRegMsg_Name'){
document.getElementById(showId).outerHTML="<span class='userRegHint' id='userRegMsg_Name'>注册帐号(只支持数字和字母,如:love,love520)<span class='hint-pointer'></span></span>";
}else{
document.getElementById(showId).outerHTML="<span class='userRegHint' id='userRegMsg_Mail'>请输入密码,请最少输入最少6位最多12位密码<span class='hint-pointer'></span></span>";
}
document.getElementById(showId).style.display="inline"
}
function hideMsg(textId,showId){
document.getElementById(showId).style.display="none";
checkUserName(textId,showId);
}
var xhr=false;
function createxhr(){
if(window.XMLHttpRequest){
xhr=new XMLHttpRequest();
}
else if(window.ActiveXObject){
try{
xhr=new ActiveXObject("Msxml2.XMLHTTP");
}catch(e){
try{
xhr=new ActiveXObject("Microsoft.XMLHTTP");
}catch(e){}
}
}
}
function send(url,showId){
createxhr();
xhr.open("post",url);
xhr.onreadystatechange=function(){callback(showId);}
xhr.setRequestHeader=("Content-Type","application/x-www-form-urlencoded");
xhr.send(null);
}
function callback(showId){
if(xhr.readyState==4){
if(xhr.status==200){
if(xhr.responseText=="nameNotReg")
document.getElementById(showId).outerHTML="<image id='userRegMsg_Name' src='images/check_right.gif'>";
else if(xhr.responseText=="mailNotReg")
document.getElementById(showId).outerHTML="<image id='userRegMsg_Mail' src='images/check_right.gif'>";
else if(xhr.responseText=="nameReg")
document.getElementById(showId).outerHTML="<image id='userRegMsg_Name' src='images/check_error.gif'>";
else
document.getElementById(showId).outerHTML="<image id='userRegMsg_Mail' src='images/check_error.gif'>";
}
}
}
function checkUserName(textId,showId){
if(document.getElementById(textId).value =="" || document.getElementById(textId).value.length==0){
if(showId =='userRegMsg_Name'){
document.getElementById(showId).outerHTML="<image id='userRegMsg_Name' src='images/check_error.gif'>";
}else{
document.getElementById(showId).outerHTML="<image id='userRegMsg_Mail' src='images/check_error.gif'>";
}
return ;
}
if(showId =='userRegMsg_Name'){
document.getElementById(showId).outerHTML="<span id='userRegMsg_Name'>检测中,请等待...</span>";
var url = "/longHua/checkUserReg.do?method=checkUserRegName&userName=" + document.getElementById(textId).value;
send(url,showId);
}else{
document.getElementById(showId).outerHTML="<span id='userRegMsg_Mail'>检测中,请等待...</span>";
var url = "/longHua/checkUserReg.do?method=checkUserRegMail&userMail=" + document.getElementById(textId).value;
send(url,showId)
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -