最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

js操作iframe父子窗體示例

 更新時間:2014年05月22日 08:58:15   作者:  
這篇文章主要介紹了js如何操作iframe父子窗體,需要的朋友可以參考下
父窗體獲取iframe

window.iframeId

iframe獲取父窗口

window.parent

parent.html
復(fù)制代碼 代碼如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript">
function btnFn(){
window.subWin.test();
}
function get(name){
return document.getElementById(name);
}
</script>
</head>
<body>
<input id="name" type="text" value="222">
<input type="button" id="btn" value="點擊" onclick="btnFn();"><br/>
<br/><br/>
<iframe src="sub.html" id="subWin"
name="subWin" width="100%" marginwidth="0" height="100%"
marginheight="0" scrolling="Yes" frameborder="0" valign="middle"
resize="no" style="display: block;border:3px solid red;"></iframe>

</body>
</html>

sub.html
復(fù)制代碼 代碼如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript" >
function test(){
alert(window.parent.get("name").value);//結(jié)果:222
}

</script>
</head>
<body>
我是窗體的內(nèi)容
</body>
</html>

相關(guān)文章

最新評論

民丰县| 龙山县| 新建县| 安阳市| 区。| 疏勒县| 扶风县| 凉城县| 连云港市| 武城县| 西峡县| 谢通门县| 涿鹿县| 德江县| 仪征市| 婺源县| 卓尼县| 玉树县| 九龙县| 台湾省| 日照市| 青阳县| 攀枝花市| 革吉县| 台安县| 射洪县| 江达县| 靖远县| 方正县| 平阳县| 枣庄市| 德州市| 公安县| 永川市| 黄平县| 象州县| 灵台县| 开远市| 南宁市| 昌吉市| 饶平县|