zoukankan      html  css  js  c++  java
  • 获取页面宽高数据 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/ ]
  • 相关阅读:
    汽车行业如何利用大数据
    汽车行业如何利用大数据
    Linux下Gcc 的编译过程
    第一个GraphX程序
    VC++ 模拟&quot;CLICK事件&quot;关闭指定窗体
    基于Canvas的Char.js库使用
    VELT-0.1.6开发:载入根文件系统
    HDU 5411 CRB and puzzle (Dp + 矩阵高速幂)
    JavaScript图片裁剪
    C++ string中的几个小陷阱,你掉进过吗?
  • 原文地址:https://www.cnblogs.com/zjfree/p/2219244.html
Copyright © 2011-2022 走看看