700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > window.open打开页面并传值 window. location.search遍历获取到的请求链接中的所有参数

window.open打开页面并传值 window. location.search遍历获取到的请求链接中的所有参数

时间:2020-03-04 17:55:15

相关推荐

window.open打开页面并传值 window. location.search遍历获取到的请求链接中的所有参数

window.open打开页面并传值,遍历 window.location.search取到的url参数

1.a.js中打开OtherBankProtocol.html页面

window.open打开OtherBankProtocol.html页面;

//阅读在线认证协议function OtherBankProtocol() {var itop = (window.screen.availHeight-530)/2;var ileft = (window.screen.availWidth-810)/2; //OtherBankProtocol bankregisterwindow.open("../perbank/instrument/OtherBankProtocol.html?AccountName="+encodeURI("中文")+"&TransferType="+"05"+"&skrkhhm="+"skrkhhm"+"&skrmc="+"skrmc"+"&voucher="+"voucher","", "fullscreen=0,height=500,width=800,toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0,top="+itop+",left="+ileft+",scrollbars=yes");}

window.open 传值,在第一个url的?号后面拼接参数;

2.OtherBankProtocol.html页面中window.location.search 获取url链接地址中的参数:

<html style="font-size: 0.14rem;list-style: none;padding: 0;position:absolute;top:0;right:0;left:0;bottom:0;background:#fff;padding:0 3%;overflow:auto;-webkit-overflow-scrolling: touch;"><head><title>协议</title><meta http-equiv="content-type" content="text/html;charset=utf-8" /><style type="text/css">h1{text-align:center;}h3{color: #f34a00;}h4{text-indent: 2rem; margin:5px 0;}p{text-indent: 2rem;margin: 5px 0;}</style></head><body><h1 >xxxxx在线认证协议</h1><h3 >甲方 <span id="TransferType" style="color: #0e0e0e"></span></h3><h3 >乙方 <span id="skrkhhmAndskrmc" style="color: #0e0e0e"></span></h3><p >甲乙双方本着自愿、平等、互利的原则,达成以下账户信息查询协议,双方承诺共同遵守:</p><p>一、甲方授权乙方在接收到甲方授权机构 <span id="skrkhhm" ></span> 发送的、授权查询人为 <span id="AccountName" ></span> 的账户信息查询请求后,向其提供指定的银行结算账户 <span id="voucher" ></span> 的 余额/交易明细 信息。授权查询协议号为[按xxx标准统一编号] 。</p><!--<script type="text/javascript" src="../../lib/min/jquery-1.11.1.min.js"></script>--><!-- jquery引用 --><script type="text/javascript" src="../../lib/min/jquery-1.11.1.min.js"></script><!-- VX2 --><script type="text/javascript" src="../../lib/min/vx2.min.js"></script><script type="text/javascript">//遍历获取url中的所有参数的方法window.onload = function () {//页面加载时 触发此方法var variables = window.location.search;//获取url中携带的参数if(variables !=null && variables != ""){//判断数据是否有效var variablesDe = decodeURI(variables);//重新编码,防止中文参数乱码var variableArray = variablesDe.substr(1).split("&");//将参数进行分割到数组中var skrkhhm;var skrmc;for (var i= 0;i<variableArray.length;i++) {//遍历数组var variable = variableArray[i].split("="); //参数名key与参数值按=号进行分割成数组switch (variable[0]) { //将参数分解开来case "AccountName": //参数 AccountName$("#AccountName").html(variable[1]); //variable[1] 参数 AccountName 的值break;case "TransferType": //参数 TransferTypevar TransferType = "("+(("05"==variable[1]?"付款方" : "被查询账户所有人")+"): "+$("#AccountName").html());$("#TransferType").html( TransferType); //variable[1] 参数 TransferType 的值break;case "skrkhhm"://参数 skrkhhm$("#skrkhhm").html( variable[1]); //variable[1] 参数 skrkhhm 的值skrkhhm =$("#skrkhhm").html();break;case "skrmc": //参数 skrmcskrmc =variable[1]; //variable[1] 参数 skrmc 的值break;case "voucher"://参数 voucher$("#voucher").html( variable[1]); //variable[1] 参数 voucher的值break;default:}}$("#skrkhhmAndskrmc").html( "("+ skrkhhm +"):"+skrmc);}}</script></body></html>

遍历 window.location.search 取到的参数

遍历获取url中的所有参数的方法

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。