码迷,mamicode.com
首页 > Web开发 > 详细

JS-property-5秒后跳转到百度

时间:2018-11-11 21:04:28      阅读:179      评论:0      收藏:0      [点我收藏+]

标签:har   time   ati   out   idt   cat   baidu   rop   head   

<!doctype html>
<html lang="en">
 <head>
  <meta charset="UTF-8">
  <title>Document</title>
 </head>
 <body>
  <script>
        function testScreen(){
            var w = screen.width;
            var h = screen.height;
            alert("宽度:"+w+",高度:"+h);
            var aw = screen.availWidth;
            var ah = screen.availHeight;
            alert("可用宽度:"+aw+",可用高度:"+ah);
        }

        function testLocation(){
            alert("5秒钟之后,跳转到百度");
            setTimeout(function(){
                location.href="http://www.baidu.com";
            },5000);
        }
            
    </script>
    <button onclick="testScreen()">测试Screen</button>
    <button onclick="testLocation()">测试Location</button>
 </body>
</html>

技术分享图片

JS-property-5秒后跳转到百度

标签:har   time   ati   out   idt   cat   baidu   rop   head   

原文地址:https://www.cnblogs.com/-hjj/p/9943360.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!