HTML弹窗传值window.open()传值

1、带参数打开新窗口


$window.open("/bdfence/bdfence-division/bdfence.html?vehicleId="+ id  );


2、获取参数


var afterUrl =  window.location.search.substring(1);(问号以后的字符串)


var afterEqual = afterUrl.substring(afterUrl.indexof('=')+1).toUpperCase();(等号以后的字符串,及你所要的参数)



var qs = window.location.search.substring(1);//获得了当前链接的中?号后的参数

if (qs.length > 0) {

    var Airways = qs.substring(qs.indexOf('=') + 1).toUpperCase();

 

location.search的值就是 "?i=1 " 
substr(1)   就是从索引1开始截取 
所以以这个页面为例的话location.search.substring(1)的值就是 "i=1 "



--------------------------------------------------------------------------

传参二




  1. <table>
  2. <tr align="left">  
  3.                     <td colspan="5">  
  4.                         <a href="javascript:openwindow()">填写你的邮寄地址</a>  
  5.                         区:    <input type="text" size="10" name="district" disabled /> &nbsp;  
  6.                         街道:<input type="text" size="10" name="street" disabled />  
  7.                     </td>  
  8.                 </tr>  
  9.             </table>  



接收:

  1. <script type="text/javascript">  
  2.        function closewindow(){  
  3.             //opener可以获取、设置通过window.open()打开此页面的父页面的值  
  4.             opener.document.myform.district.value = document.myform.district.value;  
  5.             opener.document.myform.street.value = document.myform.street.value;  
  6.             window.close();  
  7.         }  
  8.     </script>  



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值