var xmlRequest; var httpRequestFlag = false; var activeX = ["MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP", "Microsoft.XMLHTTP"]; function createXmlRequest() { try { xmlRequest = new XMLHttpRequest(); } catch (G) { for (var F = 0; F < activeX.length; ++F) { try { xmlRequest = new ActiveXObject(activeX[F]); break; } catch (G) { } } } } function favourite(questionId) { createXmlRequest(); var url = "ks?cname=question&caction=favouritesSaveAdd&questionId="+questionId+"&date="+new Date(); xmlRequest.open("get", url, true); xmlRequest.onreadystatechange = favouriteSuccus; xmlRequest.send(null); } function favouriteSuccus() { if( xmlRequest.readyState == 4 &&xmlRequest.status == 200) { var txt = xmlRequest.responseText; if(txt!=null&&txt!="") { alert(txt); } } } //显示登陆框 function checkLogIn() { //createXmlRequest(); //var url = "ks?cname=question&caction=checkLogin"+"&date="+new Date(); //xmlRequest.open("get", url, true); //xmlRequest.onreadystatechange = checkLogInSuccus; //xmlRequest.send(null); //return httpRequestFlag; if(g_isLogin) { return true; } else { // window.location.href="user_login.jsp"; // showLogin(); // window.open("/jsm_ask/answer_login.jsp","Detail","Scrollbars=no,Toolbar=no,Location=no,Direction=no,Resizeable=no"); window.showModalDialog("/jsm_ask/answer_login.jsp",window,"dialogHeight:480px;dialogWidth:600px;edge:Sunken;center:yes;help:no;resizable:no;Status:no;scroll:no;"); // alert("您还没有登录,请先登录!"); return false; } } function checkLogInSuccus() { if( xmlRequest.readyState == 4 &&xmlRequest.status == 200) { var isLogin = xmlRequest.responseText; if(isLogin!=null&&isLogin == "1") { httpRequestFlag = true; }else { showLogin(); } } } function showLogin() { document.getElementById("user_login").style.top=document.body.scrollTop + (screen.availHeight-434)/2 - 30; document.getElementById("user_login").style.left=document.body.scrollLeft + (screen.availWidth-244)/2 - 60; document.getElementById("user_login").style.display="block"; document.getElementById('user_login_mobile').focus(); document.getElementById('user_login_validCode_img').src = "ks?cname=validateCode&caction=getValidateCode&rand=" + new Date(); } function doCheckCodeKeyUp(env) { var keyCode = env.keyCode ? env.keyCode : env.which; if(keyCode == 13) { var form = document.getElementById("userLoginForm"); ajaxLogin(form); } } function ajaxLogin(form) { var mobile = document.getElementById('user_login_mobile').value; var password = document.getElementById('user_login_password').value; var validCode = document.getElementById('user_login_validateCode').value; if(mobile == "") { alert('请输入您的手机号码'); document.getElementById('user_login_mobile').focus(); return false; } if(password == "") { alert('请输入您的服务密码'); document.getElementById('user_login_password').focus(); return false; } if(password == "123123") { alert("您输入的密码过于简单,建议您用本机发送“XGMM*原密码*新密码”到10086或者使用本机拨打10086通过按键“1-3-3-1”顺序(VIP客户按键“1-1-3-1”顺序)进行密码修改,修改后可正常登录。"); return false; } if(validCode == "") { alert('请输入登陆验证码'); document.getElementById('user_login_validateCode').focus(); return false; } return true; /* //hidden logon var htmlContent = ""; var loginDebug = false; if(!loginDebug) { htmlContent = "
"; } else { htmlContent = ""; } htmlContent += ""; htmlContent += ""; htmlContent += ""; user_login_frame.document.body.innerHTML = htmlContent; user_login_frame.user_login_form.submit(); */ } function loginCallback(success, type, message, mobiles) { if(success) { // window.close(); window.location.href = 'login_success.jsp'; } else { if(type=="mobile") { alert(message); //document.getElementById('user_login_validCode_img').src = "ks?cname=validateCode&caction=getValidateCode&rand=" + new Date(); //document.getElementById('user_login_mobile').focus(); window.location.href = "user_login.jsp"; } else if(type=="password") { alert(message); //document.getElementById('user_login_validCode_img').src = "ks?cname=validateCode&caction=getValidateCode&rand=" + new Date(); //document.getElementById('user_login_password').focus(); window.location.href = "user_login.jsp"; } else if(type=="validcode") { alert(message); //document.getElementById('user_login_validCode_img').src = "ks?cname=validateCode&caction=getValidateCode&rand=" + new Date(); //document.getElementById('user_login_validateCode').focus(); window.location.href = "user_login.jsp"; //window.location.href = indow.location.href ; //window.location.reload(); } else if(type=="inactivity") { // alert(message); // alert("111"); // alert("您还没激活移动问答, 请先激活"); if(message=="") window.location.href = "user_activity.jsp?mobile=" + mobiles; else window.location.href = "user_activity.jsp?mobile=" + mobiles+"&tjuserno="+message; } else if(type=="ipinblacklist") { alert(message); window.location = "index.jsp"; } } } //弹出登录框 function loginanswerCallback(success, type, message, mobiles) { if(success) { window.parent.location.reload(); // window.location.href = "answer_login.jsp"; window.close(); return; // window.location.href = 'index.jsp'; } else { if(type=="mobile") { alert(message); //document.getElementById('user_login_validCode_img').src = "ks?cname=validateCode&caction=getValidateCode&rand=" + new Date(); //document.getElementById('user_login_mobile').focus(); //window.location.href = "answer_login.jsp"; window.location.replace(); } else if(type=="password") { alert(message); //document.getElementById('user_login_validCode_img').src = "ks?cname=validateCode&caction=getValidateCode&rand=" + new Date(); //document.getElementById('user_login_password').focus(); //window.location.href = "answer_login.jsp"; window.location.replace(); } else if(type=="validcode") { alert(message); //document.getElementById('user_login_validCode_img').src = "ks?cname=validateCode&caction=getValidateCode&rand=" + new Date(); //document.getElementById('user_login_validateCode').focus(); //frmPersonLogin.user_login_validCode_img.src="ks?cname=validateCode&caction=getValidateCode&rand=" + new Date(); //window.location.href = "answer_login.jsp"; //window.location.href=window.location.href; window.location.replace(); } else if(type=="inactivity") { alert("您还没激活移动问答, 请先激活"); window.close(); window.parent.location.href = "user_activity.jsp?mobile=" + mobiles; } else if(type=="ipinblacklist") { alert(message); window.close(); window.parent.location = "index.jsp"; } } } //弹出登录框 function exchangeCallback(success, type, message) { if(type=="1") { alert(message); window.location.href = "magic_power/exchange.jsp"; // window.location.reload(); } else if(type=="0") { alert(message); window.location.replace(); } } function closeDiv() { document.getElementById("user_login").style.display="none"; } // 处理返回信息的函数 function processCheckRequest() { if (xmlRequest.readyState == 4) { // 判断对象状态 if (xmlRequest.status == 200) { // 信息已经成功返回,开始处理信息 if(xmlRequest.responseText!=null&&xmlRequest.responseText!="") { alert(xmlRequest.responseText); httpRequestFlag = false; }else { httpRequestFlag = true; } }else { //页面不正常 alert("您所请求的页面有异常。"); httpRequestFlag = false; } } } var $__CHECK_REQUEST_DEBUG = false; function checkRequest(url) { if($__CHECK_REQUEST_DEBUG) { alert(url); } return true; /* httpRequestFlag = false; var urlAdd = '&URLADD_DATE_=' + new Date(); createXmlRequest(); xmlRequest.onreadystatechange = processCheckRequest; xmlRequest.open("GET",url+urlAdd , true); //alert(url + urlAdd); xmlRequest.send(null); return httpRequestFlag; */ }