• 获取页面宽高数据 PHP


    代码

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head>
    <title>无标题页</title>
    <style type="text/css">
    b
    {color:blue;}
    </style>
    </head>
    <body>
    <div id="div1" style="2000px; height:3000px; font-family:Consolas;" ondblclick="showSize();">
    </div>
    <script type="text/javascript">
    function show(str)
    {
    eval(
    'var value=' + str + ';');
    var strHTML = '<span>' + str + ': </span>';
    strHTML
    += '<b>'+value+'</b>';
    strHTML
    += '<br>';
    document.getElementById(
    'div1').innerHTML += strHTML;
    }
    function showSize()
    {
    show(
    'document.body.clientWidth');
    show(
    'document.body.clientHeight');
    show(
    'document.body.offsetWidth');
    show(
    'document.body.offsetHeight');
    show(
    'document.body.scrollWidth');
    show(
    'document.body.scrollHeight');
    show(
    'document.body.scrollTop');
    show(
    'document.body.scrollLeft');
    show(
    'window.screenTop');
    show(
    'window.screenLeft');
    show(
    'window.screen.width');
    show(
    'window.screen.height');
    show(
    'window.screen.availWidth');
    show(
    'window.screen.availHeight');
    show(
    'document.documentElement.offsetWidth');
    show(
    'document.documentElement.offsetHeight');
    show(
    'document.documentElement.clientWidth');
    show(
    'document.documentElement.clientHeight');
    show(
    'document.documentElement.scrollWidth');
    show(
    'document.documentElement.scrollHeight');
    document.getElementById(
    'div1').innerHTML += '<hr>';
    }
    showSize();
    </script>
    </body>
    </html>




    欢迎转载,转载请注明:转载自[ http://www.cnblogs.com/zjfree/ ]
  • 相关阅读:
    ajax
    异步加载js的方法
    node的特点,优缺点及应用场景
    ajax面试题
    jQuery实现手风琴效果
    jQuery简介
    原型
    string 对象属性和方法
    函数声明和函数表达式
    JavaScript 基本语法
  • 原文地址:https://www.cnblogs.com/zjfree/p/2219244.html
Copyright © 2020-2023  润新知