<div class="codetitle"> <span><a style="CURSOR: pointer" data="67869" class="copybut" id="copybut67869" onclick="doCopy('code67869')"><u>复制代码</u></a></span> 代码如下:</div> <div class="codebody" id="code67869"> <br> <br> <br><title>让iframe子窗体取父窗体地址栏参数(querystring)</title> <br><script type="text/javascript"> <BR>function f(){ <BR>//http://localhost:4101/MyFiles/netshop/ShopType.aspx?tid=1 <BR>var url = window.location.href;//取得地址栏 <BR>var pos = url.indexOf("tid");//简单做个字符串处理,这里只有一个参数。 <BR>var tid = url.substring(pos+4);//取tid=后面的字符串,所以+4 <BR>document.getElementById("gv_frame").src = "ShopType.aspx?tid=" + tid; <BR>} <BR></script> <br> <br> <br><iframe id="gv_frame"></iframe> <br> <br><br> </div>