BOM操作(瀏覽器物件模型)

2021-10-12 07:27:17 字數 974 閱讀 6441

瀏覽器物件模型(bom)

所有瀏覽器都支援 window 物件。它表示瀏覽器視窗

全域性變數是 window 物件的屬性,全域性函式是 window 物件的方法。

用於獲得當前頁面的位址 (url),並把瀏覽器重定向到新的頁面

document.

write

(location.href)

;//輸出當前頁面的url

document.

write

(location.pathname)

;//返回 url 的路徑名

window.location.

assign

("")//載入新的文件

window.location.

replace

("")

瀏覽器的歷史

window.alert(「sometext」);

sometext:提示的文字(無返回值)

sometext:提示的文字(返回 true / false)

sometext:提示的文字

defaultvalue:輸入的值(返回defaultvalue)

BOM瀏覽器物件模型

bom能做什麼 操作瀏覽器視窗 提供導航物件 提供定位物件 提供跟螢幕相關物件 提供對 cookie 的支援 window物件 開啟瀏覽器後麻黃素那個建立window物件,代表整個視窗 作用 操作視窗 moveby dx,dy 移動指定的距離 moveto x,y 移動到指定位置 resizeby ...

瀏覽器物件模型 BOM

bom的核心物件是window物件,其他物件都是window物件的子物件 一 瀏覽器物件模型 二 window物件 屬性 1.位置型別 瀏覽器距離螢幕的距離 ie chrome alert window.screenleft alert window.screentop ff chrome aler...

BOM 瀏覽器物件模型

延時器 var timerid settimeout cleartimeout timerid 定時器 var timerid setinterval clearinterval timerid 延時器延時一段時間執行一次 定時器 間隔一段時間不停的執行,想要停止,手動呼叫clearinterval...