js笔记5浏览器对象和history和screen
2016-07-17 18:03
591 查看
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title></title> </head> <body onload="myWin()"> <button id="btn" onclick="stopWin()">按钮</button> <p id="pid">test</p> <script> // document.write("宽度为:"+window.innerWidth+"高度为:"+window.innerHeight); // function btnClick() { // window.open("baidulogin.html","windowname","height=200,width=200,top=100,left=100,toolbar=no,menubar=no"); // window.close(); // } //延时执行 // var myTime = setInterval(function () { // getTime() // }, 1000); // function getTime() { // var d = new Date(); // var t = d.toLocaleTimeString(); // document.getElementById("pid").innerHTML = t; // } // // function stopTime(){ // clearInterval(myTime); // } //自己执行,自己调用自己 var win; function myWin() { alert("hello") win = setTimeout(function () { myWin() }, 3000); } function stopWin(){ clearTimeout(win); } </script> </body> </html>
<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><title>ceshi</title></head><body><!--<button id="btn" onclick="goceshi()">按钮</button>--><!--<script>--><!--function goceshi(){--><!--history.back();--><!--}--><!--</script>--><form><input type="text" id="username"><button id="btn" onclick="save()">按钮</button><script>function save(){var name=document.getElementById("username").value;if(name=="hello"){history.go(-1);}else{alert("输入错误")}}</script></form></body></html>
<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><title></title></head><body><a href="js_717_history.html">跳转到js_717</a><!--<button id="btn" onclick="gojs()">按钮</button>--><!--<script>--><!--//1.history对象--><!--// window.history对象包含浏览器的历史url集合--><!--//2.history方法--><!--//history.back();与在浏览器点击后退按钮相同--><!--//history.forward()与在浏览器中点击前进相同--><!--//history.go()进入某个历史界面--><!--function gojs() {--><!--history.forward();--><!--}--><!--</script>--><p id="pid"></p><button id="btn" onclick="getLoc()">按钮</button><script>function getLoc() {// location.assign("https://www.baidu.com");document.getElementById("pid").innerHTML = window.location.pathname;}document.write("可用高度"+screen.availHeight+"可用宽度"+screen.availWidth);document.write("高度"+screen.height+"宽度"+screen.width);</script></body></html>
相关文章推荐
- JS获取节点的兄弟,父级,子级元素
- javascript函数基础
- javaScript事件类型四(键盘与文本事件)
- JavaScript arguments对象
- JavaScript数组之概论
- Javascript面向对象编程(三):非构造函数的继承
- Javascript面向对象编程(二):构造函数的继承
- Javascript 面向对象编程(一):封装
- Js中诡异的Array.length
- jsp-servlet监听器
- javascript变量
- js学习笔记:命名空间
- JS学习笔记:变量提升
- JavaScript:正则表达式初体验
- js无法对远程图片进行Base64转码
- Js random随机生成正整数
- jsp-servelt的乱码问题解决
- javascript-BOM
- 初始JavaScript
- javascript正则表达式 —— RegExp 对象