• 检测设备分辨率


    <!doctype html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>无标题文档</title>
    <meta http-equiv="content-type" content="text/html; charset=gb2312">
    
    <script type="text/javascript">
    var mobileAgent = new Array("iphone", "ipod", "ipad", "android", "mobile", "blackberry", "webos", "incognito", "webmate", "bada", "nokia", "lg", "ucweb", "skyfire");
    var browser = navigator.userAgent.toLowerCase();
    var isMobile = false;
    for (var i=0; i<mobileAgent.length; i++){ if (browser.indexOf(mobileAgent[i])!=-1){ isMobile = true;
    //alert(mobileAgent[i]);
    location.href = 'http://www.baidu.com/';
    break; } }
    </script>
    </head>
    
    <body>
    <h2 align="center">请调整浏览器窗口大小</h2><hr>
    <form action="#" method="get" name="form1" id="form1">
    <!--显示浏览器窗口的实际尺寸-->
    浏览器窗口 的 实际高度: <input type="text" name="availHeight" size="4"><br>
    浏览器窗口 的 实际宽度: <input type="text" name="availWidth" size="4"><br>
    </form>
    <script type="text/javascript">
    <!-- 
    var winWidth = 0;
    var winHeight = 0;
    function findDimensions() //函数:获取尺寸
    {
    //获取窗口宽度
    if (window.innerWidth)
    winWidth = window.innerWidth;
    else if ((document.body) && (document.body.clientWidth))
    winWidth = document.body.clientWidth;
    //获取窗口高度
    if (window.innerHeight)
    winHeight = window.innerHeight;
    else if ((document.body) && (document.body.clientHeight))
    winHeight = document.body.clientHeight;
    //通过深入Document内部对body进行检测,获取窗口大小
    if (document.documentElement  && document.documentElement.clientHeight && document.documentElement.clientWidth)
    {
    winHeight = document.documentElement.clientHeight;
    winWidth = document.documentElement.clientWidth;
    }
    //结果输出至两个文本框
    document.form1.availHeight.value= winHeight;
    document.form1.availWidth.value= winWidth;
    }
    findDimensions();
    //调用函数,获取数值
    window.onresize=findDimensions;
    //-->
    </script>
    </body>
    </html>
  • 相关阅读:
    npm install命令请求制品库地址的说明
    左merge,右cherry-pick
    Spring validation中自定义的校验错误提示信息如何支持国际化
    IntelliJ IDEA中新增properties文件
    RequestFacade对象获取请求头时忽略大小写
    MongoDB高可用架构集群管理(一)
    MongoDB的备份和恢复
    Postman使用tv4进行JSON Schema结构验证和断言
    Postman中的全局/环境/集合变量的使用及优先级
    在Postman脚本中发送请求(pm.sendRequest)
  • 原文地址:https://www.cnblogs.com/xinlvtian/p/8045055.html
Copyright © 2020-2023  润新知