国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 語言 > JavaScript > 正文

js中top/parent/frame概述及案例應用

2024-05-06 14:19:38
字體:
來源:轉載
供稿:網友
引用方法top:
該變量永遠指分割窗口最高層次的瀏覽器窗口。如果計劃從分割窗口的最高層次開始執行命令,就可以用top變量。

parent:
該變量指的是包含當前分割窗口的父窗口。如果在一個窗口內有分割窗口,而在其中一個分割窗口中又包含著分割窗口,則第2層的分割窗口可以用parent變量引用包含它的父分割窗口。
附:Window對象、Parent對象、Frame對象、Document對象和Form對象的階層關系

Windwo對象→Parent對象→Frame對象→Document對象→Form對象,如下:
parent.frame1.document.forms[0].elements[0].value;
在JS中:window.location(window.location.href)和window.top.location(window.top.location.href)是一樣的意思 可以通過top來調用任何一個frame,因為top指的是最外層的frameset,可以調用它里面的任何一個子元素frame。如:top.outterFrame1.location和top.innerFrame2.location等。

parent指的是當前窗口(frame)的父窗口(frameset)可以調用它里面的任何一個子元素frame。如:parent.innerFrame1.location和parent.innerFrame2.location等。
代碼如下:
<html>
<head>
<title>top frame parent示例</title>
<script language="javaScript" type="text/javaScript">
window.location.;
</script>
</head>
<frameset id="outFrameset" rows="150,*,150" cols="*" border="5">
<frame name="frameName1" id="frameId1" src="a.html">
<frameset id="inFrameset" cols="150,*" rows="*">
<frame name="innerFrameName1" id="innerFrameId1" src="a.html">
<frame name="innerFrameName2" id="innerFrameId2" src="a.html">
</frameset>
<frame name="frameName2" id="frameId2" src="a.html">
</frameset>
</html>
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表

圖片精選

主站蜘蛛池模板: 准格尔旗| 乌拉特后旗| 塔河县| 南召县| 那曲县| 湾仔区| 霍山县| 凤城市| 靖远县| 墨玉县| 乐业县| 嵊州市| 澜沧| 广东省| 曲阜市| 乌鲁木齐市| 绿春县| 枝江市| 女性| 宝鸡市| 金阳县| 海阳市| 肥西县| 山东省| 崇州市| 丰县| 江山市| 额尔古纳市| 闵行区| 易门县| 刚察县| 六盘水市| 潞西市| 莱阳市| 博乐市| 桐梓县| 扎囊县| 元阳县| 陆川县| 宣化县| 普宁市|