让iframe子窗体取父窗体地址栏参数(querystring)

2019-12-25,,,,

复制代码 代码如下:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>让iframe子窗体父窗体地址栏参数(querystring)</title>
<script type="text/javascript">
function f(){
//http://localhost:4101/MyFiles/netshop/ShopType.aspx?tid=1
var url = window.location.href;//取得地址栏
var pos = url.indexOf("tid");//简单做个字符串处理,这里只有一个参数。
var tid = url.substring(pos+4);//取tid=后面的字符串,所以+4
document.getElementById("gv_frame").src = "ShopType.aspx?tid=" + tid;
}
</script>
</head>
<body onload="f();">
<iframe id="gv_frame"></iframe>
</body>
</html>

您可能感兴趣的文章:

  • 页面中iframe相互传值传参
  • C#,winform,ShowDialog,子窗体向父窗体传值
  • javascript 子窗体父窗体相互传值方法

《让iframe子窗体取父窗体地址栏参数(querystring).doc》

下载本文的Word格式文档,以方便收藏与打印。