<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      HTML:scrollLeft,scrollWidth,clientWidth,offsetWidth之完全詳解(轉載)

      •  

         
      • 作者: 來源: http://bbs.chinaunix.net
      • 核心提示:HTML:scrollLeft,scrollWidth,clientWidth,offsetWidth到底指的哪到哪的距離之完全詳解 scrollHeight: 獲取對象的滾動高度。 scrollLeft:設置或獲取位于對象左邊界和窗口中目前可見內容的最左端之間的距離 scrollTop:設置或獲取位于對象最頂端和窗口中可見內容的最頂端.....

       

      HTML:scrollLeft,scrollWidth,clientWidth,offsetWidth到底指的哪到哪的距離之完全詳解

      scrollHeight: 獲取對象的滾動高度。
      scrollLeft:設置或獲取位于對象左邊界和窗口中目前可見內容的最左端之間的距離
      scrollTop:設置或獲取位于對象最頂端和窗口中可見內容的最頂端之間的距離
      scrollWidth:獲取對象的滾動寬度
      offsetHeight:獲取對象相對于版面或由父坐標 offsetParent 屬性指定的父坐標的高度
      offsetLeft:獲取對象相對于版面或由 offsetParent 屬性指定的父坐標的計算左側位置
      offsetTop:獲取對象相對于版面或由 offsetTop 屬性指定的父坐標的計算頂端位置
      event.clientX 相對文檔的水平座標
      event.clientY 相對文檔的垂直座標

      event.offsetX 相對容器的水平坐標
      event.offsetY 相對容器的垂直坐標
      document.documentElement.scrollTop 垂直方向滾動的值
      event.clientX+document.documentElement.scrollTop 相對文檔的水平座標+垂直方向滾動的量

        以上主要指IE之中,FireFox差異如下:
      IE6.0、FF1.06+:
      clientWidth = width + padding
      clientHeight = height + padding
      offsetWidth = width + padding + border
      offsetHeight = height + padding + border
      IE5.0/5.5:
      clientWidth = width - border
      clientHeight = height - border
      offsetWidth = width
      offsetHeight = height
      (需要提一下:CSS中的margin屬性,與clientWidth、offsetWidth、clientHeight、offsetHeight均無關)
        
      代碼
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[url=http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd[/url]">
      <html xmlns="[url=http://www.w3.org/1999/xhtml]http://www.w3.org/1999/xhtml[/url]" lang="gb2312">
      <head>
      <head>
      <title> 代碼實例:關于clientWidth、offsetWidth、clientHeight、offsetHeight的測試比較 </title>
      <meta http-equiv="content-type" content="text/html; charset=gb2312" />
      <meta name="author" content="楓巖,CnLei.y.l@gmail.com">
      <meta name="copyright" content="[url=http://www.cnlei.com]http://www.cnlei.com[/url]" />
      <meta name="description" content="關于clientWidth、offsetWidth、clientHeight、offsetHeight的測試比較" />
      <style type="text/css" media="all">
      body
      {font-size:14px;}
      a,a:visited
      {color:#00f;}
      #Div_CnLei
      {
      width
      :300px;
      height
      :200px;
      padding
      :10px;
      border
      :10px solid #ccc;
      background
      :#eee;
      font-size
      :12px;
      }
      #Div_CnLei p
      {margin:0;padding:10px;background:#fff;}
      </style>
      <script type="text/javascript">
      function Obj(s){
      return document.getElementById(s)?document.getElementById(s):s;
      }
      function GetClientWidth(o){
      return Obj(o).clientWidth;
      }
      function GetClientHeight(o){
      return Obj(o).clientHeight;
      }
      function GetOffsetWidth(o){
      return Obj(o).offsetWidth;
      }
      function GetOffsetHeight(o){
      return Obj(o).offsetHeight;
      }
      </script>
      </head>
      <body>
      <p>點擊下面的鏈接:</p>
      <div id="Div_CnLei">
      <p><a href=http://bbs.chinaunix.net/"javascript:alert(GetClientWidth('Div_CnLei'));">GetClientWidth();</a> <a href=http://bbs.chinaunix.net/"javascript:alert(GetClientHeight('Div_CnLei'));">GetClientHeight();</a></p>
      <p><a href=http://bbs.chinaunix.net/"javascript:alert(GetOffsetWidth('Div_CnLei'));">GetOffsetWidth();</a> <a href=http://bbs.chinaunix.net/"javascript:alert(GetOffsetHeight('Div_CnLei'));">GetOffsetHeight();</a></p>
      </div>
      <div id="Description">
      <p><strong>IE6.0、FF1.06+:</strong><br />
      clientWidth = width + padding = 300+10×2 = 320
      <br />
      clientHeight = height + padding = 200+10×2 = 220
      <br />
      offsetWidth = width + padding + border = 300+10×2+10×2= 340
      <br />
      offsetHeight = height + padding + border = 200+10×2+10×2 = 240
      </p>
      <p><strong>IE5.0/5.5:</strong><br />
      clientWidth = width - border = 300-10×2 = 280
      <br />
      clientHeight = height - border = 200-10×2 = 180
      <br />
      offsetWidth = width = 300
      <br />
      offsetHeight = height = 200
      </p>
      </div>
      </body>
      </html>

       

       
       
      Javascript:scrollWidth,clientWidth,offsetWidth的區別(轉)

      clientWidth
      是對象可見的寬度,不包滾動條等邊線,會隨窗口的顯示大小改變。

      scrollWidth
      是對象的實際內容的寬,不包邊線寬度,會隨對象中內容的多少改變(內容多了可能會改變對象的實際寬度)  

      offsetWidth
      是對象的可見寬度,包滾動條等邊線,會隨窗口的顯示大小改變。


      ------------------------------------------------
      一個scrollWidth和clientWidth的例子:
      <html>
      <head>
      <title>77.htm文件</title>
      </head>

      <body>
      <textarea wrap="off" onfocus="alert('scrollWidth:'+this.scrollWidth+'\n clientWidth:'+this.clientWidth);"></textarea>
      </body>
      </html>
      在文本框內輸入內容,當橫向滾動條沒出來前scrollWidth和clientWidth的值是一樣的。
      當一行內容超出文本框的寬度,就有橫向滾動條出來了,scrollWidth的值就變了。
      scrollWidth是對象實際內容的寬度。
      clientWidth是對象看到的寬度(不含邊線),這個例子里不會改變。


      -----------------------------------------------
      一個clientWidth和offsetWidth的例子:
      <html>
      <head>
      <title>77.htm文件</title>
      </head>

      <body>
      <textarea wrap="off" onfocus="alert('offsetWidth:'+this.offsetWidth+'\n clientWidth:'+this.clientWidth);"></textarea>
      </body>
      </html>

      offsetWidth的值總是比clientWidth的值打
      clientWidth是對象看到的寬度(不含邊線)
      offsetWidth是對象看到的寬度(含邊線,如滾動條的占用的寬)

      posted @ 2010-06-11 15:36  ued  閱讀(616)  評論(0)    收藏  舉報
      主站蜘蛛池模板: 人妻少妇久久中文字幕| 人人妻人人狠人人爽| 成人国产一区二区三区精品| 亚洲精品中文字幕在线观| 少妇爽到呻吟的视频| 亚洲av综合av一区| 在线看片免费人成视频久网| 久青草久青草视频在线观看| 免费AV片在线观看网址| 色熟妇人妻久久中文字幕| 久久精品夜夜夜夜夜久久| 亚洲日韩AV秘 无码一区二区| 精品蜜臀国产av一区二区| 成人午夜视频在线| 成人福利国产午夜AV免费不卡在线| 91亚洲国产三上悠亚在线播放| 精品国产高清中文字幕| 乱人伦人妻中文字幕| 亚洲人成网站在线无码| 老司机精品成人无码AV| 日韩有码中文在线观看| 99网友自拍视频在线| 唐人社视频呦一区二区| 色婷婷av久久久久久久 | 五月婷婷久久草| 亚洲国产午夜精品理论片| 免费无码va一区二区三区| 亚洲区日韩精品中文字幕| 野花在线观看免费观看高清| 在线观看美女网站大全免费| 国产精品十八禁一区二区| 中国猛少妇色xxxxx| 成人午夜福利精品一区二区| 久久天天躁狠狠躁夜夜婷| 乱熟女高潮一区二区在线| 亚洲一区二区三区在线| 丝袜欧美视频首页在线| 亚洲色大成网站WWW久久| 国产原创自拍三级在线观看| 久久午夜无码鲁丝片午夜精品| 天堂网av成人在线观看|