|
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>讓iframe子窗體取父窗體地址欄參數(shù)(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");//簡單做個(gè)字符串處理,這里只有一個(gè)參數(shù)。
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>
JavaScript技術(shù):讓iframe子窗體取父窗體地址欄參數(shù)(querystring),轉(zhuǎn)載需保留來源!
鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請(qǐng)第一時(shí)間聯(lián)系我們修改或刪除,多謝。