分享

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

 gearss 2016-05-27

<html xmlns="http://www./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>

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多