亚洲婷婷综合另类一区|国产亚洲精品拍拍视频|精品视频无码精品视频久久|精品一线天粉嫩无码

<b id="twb6z"></b>
<b id="twb6z"><address id="twb6z"><progress id="twb6z"></progress></address></b><b id="twb6z"><address id="twb6z"></address></b>

<b id="twb6z"><address id="twb6z"></address></b>
<tt id="twb6z"></tt>
<u id="twb6z"><small id="twb6z"></small></u>
<tt id="twb6z"><address id="twb6z"></address></tt>
<u id="twb6z"><small id="twb6z"><meter id="twb6z"></meter></small></u>

云南網(wǎng)站建設(shè)創(chuàng)新企業(yè) 昆明多彩網(wǎng)絡(luò)公司

在線qq:540105663

window.onscroll和document.body.onscroll的區(qū)別

來源:昆明網(wǎng)絡(luò)公司 日期:2010-09-19 閱讀: 發(fā)表評(píng)論

在使用頁面滾動(dòng)元素的時(shí)候,總會(huì)遇到幾個(gè)dhtml屬性存在兼容問題,這里介紹一個(gè)常用的window.onscroll和document.body.onscroll,它們的含義一樣,但是在不同瀏覽器的表現(xiàn)不一樣

當(dāng)頁面滾動(dòng)的時(shí)候:window.onscroll和document.body.onscroll的區(qū)別:在ie6下面只認(rèn)window.onscroll。

document.body.scrollTop(頁面被卷起的高度) 值總為 0 的解決方法

頁面具有 DTD(或者說指定了 DOCTYPE)時(shí),使用 document.documentElement。

頁面不具有 DTD(或者說沒有指定了 DOCTYPE)時(shí),使用 document.body。在 IE 和 Firefox 中均是如此。

為了兼容(不管有沒有 DTD),可以使用如下代碼:

var scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;

發(fā)表評(píng)論評(píng)論列表(有 條評(píng)論)

相關(guān)文章:
暫無相關(guān)文章
最熱文章:
新手怎么制作網(wǎng)頁? 閱讀:7660
jcarousellite中文文檔 閱讀:6507
表單元素input、按鈕、文字完美垂 閱讀:6247
怎么使chrome(谷歌google 閱讀:6145
phpMailer中文文檔手冊(cè) 閱讀:4639