舉例如下
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | function run() { var d = window.frames; var i; for (i = 0; i < d.length; i++) { d[i].location = "window004_2.html" ; } } /* 《程式語言教學誌》的範例程式 檔名:window003.js 功能:示範 JavaScript 程式 作者:張凱慶 時間:西元 2011 年 8 月 */ |
此例將所有的內嵌網頁的網址檔案更新為 window004_2.html
2 3 4 5 6 | var d = window.frames; var i; for (i = 0; i < d.length; i++) { d[i].location = "window004_2.html" ; } |
我們以下面的 HTML 網頁載入
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | <!DOCTYPE html> < html > < head > < title >HTML DOM DEMO</ title > < script src = "window004.js" type = "text/javascript" ></ script > </ head > < body > < iframe src = "window004_1.html" ></ iframe > < iframe src = "window004_1.html" ></ iframe > < div > < input type = "button" value = "RUN" onclick = "run();" > </ div > </ body > </ html > <!-- 《程式語言教學誌》的範例程式 檔名:window004.html 功能:示範 JavaScript 程式 作者:張凱慶 時間:西元 2011 年 8 月 --> |
window004_1.html 如下
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | <!DOCTYPE html> < html > < head > < title >HTML DOM DEMO</ title > </ head > < body > There is no spoon. </ body > </ html > <!-- 《程式語言教學誌》的範例程式 檔名:window004_1.html 功能:示範 JavaScript 程式 作者:張凱慶 時間:西元 2011 年 8 月 --> |
window004_2.html 如下
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | <!DOCTYPE html> < html > < head > < title >HTML DOM DEMO</ title > </ head > < body > Choice. The problem is choice. </ body > </ html > <!-- 《程式語言教學誌》的範例程式 檔名:window004_2.html 功能:示範 JavaScript 程式 作者:張凱慶 時間:西元 2011 年 8 月 --> |
瀏覽器 (broswer) 開啟 window004.html

點擊 RUN 後如下

中英文術語對照 | |
---|---|
瀏覽器 | broswer |
物件 | object |
您可以繼續參考
window 物件
- 屬性
- window.closed
- window.document
- window.frameElement
- window.frames
- window.history
- window.location
- window.innerHeight
- window.innerWidth
- window.length
- window.name
- window.navigator
- navigator.appCodeName
- navigator.appName
- navigator.appVersion
- navigator.buildID
- navigator.cookieEnabled
- navigator.language
- navigator.mimeTypes
- navigator.onLine
- navigator.oscpu
- navigator.platform
- navigator.plugins
- navigator.product
- navigator.userAgent
- navigator.vendor
- navigator.javaEnabled()
- window.opener
- window.outerHeight
- window.outerWidth
- window.pageXOffset
- window.pageYOffset
- window.parent
- window.screen
- window.screen.availTop
- window.screen.availLeft
- window.screen.availHeight
- window.screen.availWidth
- window.screen.colorDepth
- window.screen.height
- window.screen.left
- window.screen.pixelDepth
- window.screen.top
- window.screen.width
- window.screenX
- window.screenY
- window.scrollMaxX
- window.scrollMaxY
- window.scrollX
- window.scrollY
- window.self
- window.status
- window.top
- 方法
- window.close()
- window.open(sU, sN, sF)
- window.alert()
- window.back()
- window.blur()
- window.focus()
- window.clearInterval(id)
- window.setInterval(f, d)
- window.clearTimeout(id)
- window.setTimeout(f, d)
- window.confirm(m)
- window.escape(r)
- window.unescape(e)
- window.forward()
- window.getComputedStyle(e)
- window.home()
- window.moveBy(x, y)
- window.moveTo(x, y)
- window.print()
- window.prompt(t, v)
- window.resizeBy(x, y)
- window.resizeTo(x, y)
- window.scroll(x, y)
- window.scrollBy(x, y)
- window.scrollByLines(n)
- window.scrollByPages(n)
- window.scrollTo(x, y)
相關目錄
HTML DOM 快速導覽
JavaScript 教材
首頁
參考資料
https://developer.mozilla.org/en/DOM/window.frames
沒有留言:
張貼留言