? ?? ?? ? ???
? ?? ??
?? ? ??? ?? ??? ?????.
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>php.cn</title> <script> //循環(huán)遍歷window對(duì)象的所有屬性 /* for(name|index in obj|arr){ } 描述:只能循環(huán)數(shù)組的下標(biāo),或?qū)ο蟮膶傩浴? 說明:如果循環(huán)數(shù)組的話,每次循將取下標(biāo)值。 對(duì)于數(shù)組中值為undefined的,不會(huì)循環(huán)。 循環(huán)數(shù)組,只返回有效的值。 如果循對(duì)象的話,每次循環(huán)取對(duì)象屬性。 嚴(yán)格的來說,對(duì)象中沒有方法一說,所有的都是屬性。 將一個(gè)函數(shù)賦給一個(gè)屬性后,這個(gè)屬性就變成方法了。 */ var i = 1; for(var name in window) { document.write(i+" "+name+"<br>"); i++; } </script> </head> <body> </body> </html>
name : ???? ??? ???? ??? ?????. ? ??? a ??? ?? ??? ?????.
? ?? ??: window.name = “newWin”
? ?? ???? : document.write (??);
top: ??? ?? ?????. ?: window.top
parent: ?? ???? ???? ?? ?? ?????.
self: ?? ?? ???? ?? ???? ?????.
innerWidth: ???? ?? ?? ??? ?????(?? ???, ?? ??, ?? ???, ?? ??? ??). ? ??? Firefox?? ?????.
IE??? window.innerWidth ?? document.documentElement.clientWidth? ?????
innerHeight: ???? ?? ?? ??? ?????(?? ???, ?? ??, ?? ???, ?? ??? ??). ? ??? Firefox?? ?????.
IE??? window.innerHeight ?? document.documentElement.clientHeight? ?????.
document.documentElement?< ;html>???. ; ?? ??
document.body? <body> ?? ??
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>php.cn</title> <script> //實(shí)例:測試當(dāng)前網(wǎng)頁的寬度和高度 //兼容所有瀏覽器 var width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth; var height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight; //輸出結(jié)果 document.write("寬度:"+width+",高度:"+height); </script> </head> <body> </body> </html>
? ?? ???
-
alert(): ?? ?? ??? ?????.
prompt(): ?? ?? ??? ????.
confirm(): ?? ?? ??? ?????. ?? ??? ???? true? ???? ??? ???? false? ?????.
close(): ?? ????
print(): ?? ?????
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>php.cn</title> <script> function delect() { if(window.confirm("你確認(rèn)要?jiǎng)h除嗎?")){ //跳轉(zhuǎn)到指定刪除頁面執(zhí)行刪除操作 location.href="http://ipnx.cn"; } } </script> </head> <body> <a href="#" onClick="delect()">刪除</a> </body> </html>