JS浏览器对象
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>JS浏览器对象</title> </head> <body onload="myWin()"> <button id="btn" onclick="goceshi()">按钮</button> <p id="ptime"></p> <a href="Html2.html">跳转到Html2</a> <!--<script> //document.write("宽度" + window.innerWidth + "高度" + window.innerHeight); function btnClick() { //window.open("/Html/Html2.html","windowName","height=200,width=200,top=100,left=100,toolbar=no,menubar=no"); window.close(); } </script>--> <!--<script> var mytime = setInterval(function () { getTime(); }, 1000); function getTime() { var d = new Date(); var t = d.toLocaleTimeString(); document.getElementById("ptime").innerHTML = t; } function stopTime() { clearInterval(mytime); } </script>--> <!--<script> var win; function myWin() { alert("hello"); win = setTimeout(function () { myWin(); }, 3000); } function stopWin() { clearTimeout(win); } </script>--> <script> function goceshi() { history.back(); history.forward(); history.go(); } </script> </body> </html>
Location对象
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>Location对象</title> </head> <body> <button id="btn" onclick="getLoc()">按钮</button> <p id="ptime"></p> <!--<script> function getLoc() { //document.getElementById("ptime").innerHTML = window.location.pathname; //document.getElementById("ptime").innerHTML = window.location.port; //document.getElementById("ptime").innerHTML = window.location.href; location.assign("http://www.baidu.com"); } </script>--> <script> document.write("可用宽度" + screen.availWidth + "可用高度" + screen.availHeight); document.write("宽度" + screen.width + "高度" + screen.height); </script> </body> </html>