BOM(browers object model) 是瀏覽器的模型 要在Web中使用js Bom無疑才是真正的核心
BOM的核心
window 他是和ECMAScript的Gobal對象 也是JS訪問瀏覽器的一個接口
window下的對象
框架
他下面包含有框架 frameset frame
窗口
innerWIdth/Height outerWidth/Height
也可以利用 document.documentElement.cilentHeight/Width
document.body.cilentHeight/Width
導(dǎo)航 打開窗口
window.open(四個參數(shù))
window.open(“URL”,"tapFrames") //a href="Url" target="tapFrame"
打開url 在topFrames 名字的框架中 如果沒有 就打開新的鏈接命名為tapFrames 第二個參數(shù) 可以用a中的target的任意屬性
定時器
setTimeout(fn,time) setInterval(fn,time) clearTimeout(name) clearInterval(name)
系統(tǒng)對話框
alert() confirm() prompt()`
location 對象
即是window屬性也是document的屬性
location下的屬性 全是可以讀取設(shè)置的
hash 哈希值
host 主機名和端口號
hostname 不帶端口號的主機名
href 獲取設(shè)置 當(dāng)前的url
pathname 當(dāng)前的目錄
port 端口
protocol 協(xié)議
search 查詢字符串蝴蜓?后的
改變?yōu)g覽器的頁面路徑
location.href=""
location. assign=""
location.replace="url" //這個不會有back返回
navigator 返回瀏覽器的信息
直接name
description
filename
length
用來檢測瀏覽器的插件
screen 對象 用處不大不多說
history 對象
go() 返回頁面 0作為當(dāng)前頁面 也可以直接寫路徑
back() 后退
forwards()前進(jìn)