日期:2014-05-16 浏览次数:20386 次
<script type="text/javascript"> var xmlHttp; function createXMLHttpRequest() { if(window.XMLHttpRequest) //非IE浏览器及IE7(7.0及以上版本),用xmlhttprequest对象创建 { xmlHttp=new XMLHttpRequest(); } else if(window.ActiveXObject) //IE(6.0及以下版本)浏览器用activexobject对象创建,如果用户浏览器禁用了ActiveX,可能会失败. { xmlHttp=new ActiveXObject("Microsoft.XMLHttp"); } } //取城市 function getCity(){ document.getElementById("citySpan").innerHTML="<img src='https://application.dodopal.com:9998/fapayf/images/ajax-loader.gif'/>正在加载城市信息,请稍后..."; //document.all.chargeItem.focus(); if(!xmlHttp) { createXMLHttpRequest(); } xmlHttp.open("POST", "https://application.dodopal.com:9998/fapayf/chargeCardCity.action",true); xmlHttp.onreadystatechange = setCity; xmlHttp.setRequestHeader('Content-type','application/x-www-form-urlencoded;charset=UTF-8'); xmlHttp.send(null); } //城市取到后反显 function setCity(){ if(xmlHttp.readyState == 4 && xmlHttp.status == 200){ document.getElementById("citySpan").innerHTML=xmlHttp.responseText; changeCity(); } } //选择城市 function changeCity(){ //var yktid = document.getElementById("yktid").value; var radios=document.getElementsByName("yktid"); var theRadioValue = 0; for(var i=0;i<radios.length;i++) { if(radios[i].checked==true) { theRadioValue = radios[i].value; break; } } getJinE(theRadioValue);//加载银行费率 } //加载OCX function getOCX(yktid){ document.getElementById("displayframe").src="https://application.dodopal.com:9998/fapayf/getOCX.action?yktid="+yktid; } //取银行费率 function getJinE(yktid){ if(!xmlHttp) { createXMLHttpRequest(); } xmlHttp.open("POST", "https://application.dodopal.com:9998/fapayf/getJinE.action?yktid="+yktid,true); xmlHttp.onreadystatechange = setFeiLv; xmlHttp.setRequestHeader('Content-type','application/x-www-form-urlencoded;charset=UTF-8'); xmlHttp.send(null); } function setFeiLv(){ if(xmlHttp.readyState == 4 && xmlHttp.status == 200){ document.getElementById("feilv").innerHTML = xmlHttp.responseText; setBank(); } } //根据支付方式设置银行 function setBank(){ var radios=document.getElementsByName("payType"); var theRadioValue = 0; for(var i=0;i<radios.length;i++) { if(radios[i].checked==true) { theRadioValue = radios[i].value; if(theRadioValue!="72" && theRadioValue!="71" && theRadioValue!="2"){ theRadioValue="73"; } break; } } if(theRadioValue==0){ alert("请选择支付方式!!"); }else{ var s = document.getElementById("blankid"); //获取select标记 if(s==null || s=='undefined'){ alert("请先选择您的公交卡所在的城市!!!"); }else{ var ops= s.options; //获取对select标记options的引用 for(var i=0; i<s.length; i++){ var opValue = ops[i].value; var b22 = opValue.split("-"); if(b22[0]==theRadioValue){ s.options[i].selected=true; break; } } } } } //输入充值金额后触发的事件 function setChargeItem(chargeValue){ if(chargeValue==""){ return; } if(parseInt(chargeValue)%10!=0){ //校验是否为10的整倍数 alert( '必须输入10的倍数 ') ; document.all.chargeItem.value=''; }else{ //计算手续费及总金额 if(Number(chargeValue)>1000){ alert("充值最大金额不能超过1000!!!"); document.all.chargeItem.value=''; }else{ fee(); } } } //计算费率 function fee(){ var radios=document.getElementById("chargeItem").value; var x1 = radios; var x2= document.getElementById("blankid").value; var x22=x2.split("-"); var x222=x22[1]; var zongjinezej=x1*x222+Number(x1); //手续费 document.all.shouxufei.innerText=x1*x222+"元"; //总金额 document.all.zongjineid.innerText=zongjinezej+"元"; } //变换支付方式 function changeBank(){ var s = document.getElementById("blankid"); //获取select标记 if(s==null || s=='undefined'){ alert("请先选择您的公交卡所在的城市!!!"); }else{ setBank(); fee(); } } //充值校验 function checkCharge(ev){ var objPos = mousePosition(ev); var chargeValue = document.all.chargeItem.value; if(chargeValue=='' || chargeValue==' '){ alert("请输入充值金额!!"); document.all.chargeItem.focus(); }else{ var yktid = document.all.yktid.value; var radios=document.getElementsByName("yktid"); var theRadioValue = 0; for(var i=0;i<radios.length;i++) { if(ra