当前位置:编程学习 > JS >>

js向html 传递参数

js 文件function a(){ 
    show_modelId += model_id; 
    window.open("a.htm?show_modelId="+show_modelId+"",'','height=400,width=800,location=yes'); 
}   把show_modelId 的值传递到页面   www.zzzyk.com
a.html 

<input type="text" name="hidden_ID"  ID="hidden_ID" style="width: 300px;"/> 
  <script> 
//获得参数的方法 
var request = 

QueryString : function(val) 

var uri = window.location.search; 
var re = new RegExp("" +val+ "=([^&?]*)", "ig"); 
return ((uri.match(re))?(uri.match(re)[0].substr(val.length+1)):null); 


</script> <script>//调用方法获得参数var modelid = request.QueryString("show_modelId");document.getElementById("hidden_ID").value=modelid;</script>  

作者 Heng_Ji

补充:web前端 , JavaScript ,
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,