本文共 1715 字,大约阅读时间需要 5 分钟。
JavaScript????????
JavaScript??BOM??
????????Browser Object Model?BOM??JavaScript???????????????????????????????????Window????????????????????
1.Window ??
Window???BOM?????????????????????????????????????????????
1.1 ?????????
???????????????????????????
-
?????????Chrome?Firefox?Safari???
window.innerHeight?????????????window.innerWidth?????????????
-
??IE8??????
document.documentElement.clientHeight?????????????document.documentElement.clientWidth?????????????- ??
document.body.clientHeight?document.body.clientWidth
????????????????????????????
1.2 Window ?????
Window??????????????????
open(URL, name, features, replace)
?????????????????????????
URL????????????????????name?????????????<a>?<form>?target??features??????????????????replace??????????????????????
?????
???????`open()` ??? `Document.open()` ??????????? `Window.open()`
close() ??
close() ??????????????????????
- ???? JavaScript ?????????
- ???????????????
?????
2.JavaScript????
JavaScript ????????????
window.alert("sometext")??????window.confirm("sometext")????????????window.prompt("sometext", "defaultvalue")????????????? null
?????
???`window.confirm()` ?? `true` ? `false`?`window.prompt()` ?????? `null`
3.Window Screen ??
Window.screen ?????????????
screen.width?screen.height??????????screen.availWidth?screen.availHeight????????????screen.colorDepth????????screen.pixelDepth????????
?????
4.Window Location ??
Window.location ?????????????????
location.href???????? URLlocation.pathname??? URL ?????location.search??? URL ????????????location.assign()???????
?????
???`window.location.href` ?????????? URL?
???`window.location.href` ????? `window.location.href=("url ?string")` ???
window.location.href ?????
?????
发表评论
最新留言
关于作者