12306查询火车晚点的地址:http://www.12306.cn/map_zwdcx/CCCX.jsp 好吧,但是我用IE、搜狗都显示不出来验证码,而且点击【查询】也没有任何提示。百度到的方法:在console下输入 window.spans=new Array(); 回车这个时候只需要输入站点和车次,再点击【查询】就可以直接查询了,测试了一下,的确如此。请问大神们这是为什么呢?附上部分代码:DIV:<tr align="center">
<td><b>验证码:</b></td>
<td align="left"><table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input maxlength="5" name="yzm" tabindex="5" id="yzm" size="12" onKeyDown="yzmEnter()"></td>
<td height="20" ><div id="divCode" onClick="javascript:validteCode()" title="单击更换验证码" style="cursor:hand;"> <span></span><span></span><span></span><span></span><span></span> </div>
<script language="JavaScript" type="text/JavaScript">
var codes = new Array(5); //用于存储随机验证码
var colors = new Array("#FF0000","#0000FF","#FF6600","#006600","#660000","#990066","#000000","#6600CC","#990099","#CC0099");
for(var i=0;i < codes.length;i++){//获取随机验证码
codes[i] = Math.floor(Math.random()*10);
}
var spans = document.getElementById("divCode").all;
for(var i=0;i<spans.length;i++){
spans[i].innerHTML=codes[i];
spans[i].style.color = colors[Math.floor(Math.random()*10)]; //随机设置验证码颜色
}
</script></td>
</tr>
</table></td>
</tr>
<tr align="center">
<td colspan="2"><input type="button" tabindex="6" class="btn1" value=" 查 询 " name="chaxunBtn" id="chaxunBtnId" onClick="chaxunFun()" />
<input type="button" tabindex="7" class="btn1" value=" 重 置 " name="chongzhiBtn" id="chongzhiBtnId" onClick="chongzhiFun()"/></td>
</tr>JS:function chaxunFun(){//查询按钮的事件处理
var resultJsp = document.getElementById("resultJsp");
resultJsp.innerHTML = "";
var chezhanInput = document.getElementById("chezhanInId");
if(chezhanInput.disabled==false){
if(chezhanInput.value==""){
alert("错误提示:\n\n请输入车站信息!");
chezhanInput.focus();
return;
}
}
var chechiInput = document.getElementById("chechiInId");
if(chechiInput.value==""){
alert("错误提示:\n\n请输入车次信息!");
chechiInput.focus();
return;
}
var rightcode="";
for(var i=0;i<spans.length;i++){
rightcode+=spans[i].innerHTML;
}
if(document.getElementById("yzm").value!=rightcode){
alert("验证码不正确,请重新输入!");
document.getElementById("yzm").focus();
return false;
}
document.getElementById("resultJsp").innerHTML="正在查询,请稍候...";
//checkCZ();
fromtoFun();
}
1 回答
- 1 回答
- 0 关注
- 2083 浏览
添加回答
举报
0/150
提交
取消