2015/12/9--window对象

<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>

posted on 2015-12-09 22:14  琳姐姐  阅读(118)  评论(0)    收藏  举报

导航