標籤:
<html>
<head>
<script>
var w = window.innerWidth;
document.documentElement.clientWidth;
document.body.clientWidth;//顯示出瀏覽器的寬度
var h = window.clientHeight;
document.documentElement.clientHeight;
document.body.clientHeight;//顯示出瀏覽器的高度
/*01 window.open()--開啟新視窗
02 window.close()--關閉當前視窗
03 window.moveTo()--移動當前視窗
04 window.resizeTo()--調整當前視窗的尺寸
05 window.screen()--高度和寬度
*/
document.write("可用高度" + screen.availHeight);
document.write("可用寬度" + screen.availWidth);
/* 01 location.hostname 返回 web 主機的網域名稱
02 location.pathname 返回當前頁面的路徑和檔案名稱
03 location.port 返回 web 主機的連接埠 (80 或 443)
04 location.protocol 返回所使用的 web 協議(http:// 或 https://)
*/
document.write(location.href);//整個頁面的URL
document.write(location.pathname);
function newDoc(){
window.location.assign("http://www.w3cschool");//載入到新的網頁
}
function goback(){
window.history.back();
}
function goForward(){
window.history.gofoward();
}
</script>
</head>
<body>
<input type = "button" value = "載入新文檔" onclick = "newDoc()">
<input type = "button" value = "back" onclick = "goback()">
<input type = "button" value = "goForward" oncilick = "goforward()">
alert("文本");
confirm("文本");
prompt("文本","預設值");
</body>
</html>
2015/12/9--window對象