zoukankan      html  css  js  c++  java
  • html的对象可以通过getBoundingClientRect()取得其真实位置,例子如下:

    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    </head>

    <body>
    <table width="200" border="1">
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td><table width="362" border="1">
          <tr>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td height="135">&nbsp;</td>
            <td>&nbsp;</td>
            <td><table width="200" border="1" cellpadding="0" cellspacing="0" bordercolor="#0000FF" id="aa" style="border-collapse:collapse;">
              <tr>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
              </tr>
            </table></td>
            <td>&nbsp;</td>
          </tr>
        </table></td>
      </tr>
    </table>
    <script language="javascript">
     //alert(aa.getBoundingClientRect()["right"]);
     alert(aa.getBoundingClientRect().right);
     for (var i in aa.getBoundingClientRect()){
      document.writeln(i+"="+aa.getBoundingClientRect()[i]);
     }
    </script>
    </body>
    </html>



    本文来自:http://blog.csdn.net/sungcong/archive/2005/12/09/547848.aspx

  • 相关阅读:
    基本的Web控件二
    基本的Web控件一
    centos更改默认语言
    nginx优化配置
    使用nginx的proxy_cache做网站缓存
    centos7配置笔记
    redis批量删除
    Linq常用操作
    MVC ViewData和ViewBag[转]
    Transact-SQL的除法问题
  • 原文地址:https://www.cnblogs.com/Godblessyou/p/1779431.html
Copyright © 2011-2022 走看看