我要实现多选项卡登录,选择不同选项卡,填写密码、用户名后,点击登录到不同的地方。
功能在IE内核的浏览器好用,在chrome内核浏览器时报错如下:
1、点击选项卡时报错:cannot call method 'getElementById' of undefined。
2、输入密码登录时,页面只刷新,不转跳。
代码如下:
<br> function qhdt1(a)<br> {</p> <pre><code>for(var i=1;i<5;i++) { this.document.getElementById("dltp"+i).src="<%=request.getContextPath()%>/image/dl-04-"+i+"-1.gif"; } this.document.getElementById("lb").value=a; this.document.getElementById("dltp"+a).src="<%=request.getContextPath()%>/image/dl-04-"+a+"-2.gif"; hello.querylogin(a,test3); </code></pre> <p>}</p> <p>function test3(data)<br> {<br> //alert();<br> this.document.getElementById("logindiv").innerHTML=data;<br> //alert(document.getElementById("logindiv").innerHTML);<br> }</p> <p>function tj()<br> {</p> <pre><code>var lb=this.document.getElementById("lb").value; alert(lb); var yhm=this.document.getElementById("yhm"); if(ChkUtil.isNull(yhm.value)) { alert("登录名称不能为空"); yhm.focus(); return; } var mm=this.document.getElementById("mm"); if(ChkUtil.isNull(mm.value)) { alert("密码不能为空"); mm.focus(); return; } if(lb==1) { this.document.thisform.password.value = mm.value ; alert(mm.value); this.document.thisform.user.value = yhm.value ; alert(yhm.value); this.document.thisform.action="http://mail.hljbsm.gov.cn/?q=login.do"; this.document.thisform.submit(); this.window.location.href="qt_index.jsp"; }....... </code></pre> <p>}<br>