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

  • 相关阅读:
    uTenux-OS-Task再探
    uTenux——LED驱动讲解
    uTenux——HelloWord
    uTenux——重新整理底层驱动库
    template的超级bug
    [LeetCode] Integer to Roman
    [LeetCode] Roman to Integer
    [LeetCode]Flatten Binary Tree to Linked List
    [LeetCode] LRU Cache [Forward]
    [LeetCode] Reorder List
  • 原文地址:https://www.cnblogs.com/Godblessyou/p/1779431.html
Copyright © 2011-2022 走看看