zoukankan      html  css  js  c++  java
  • 【javascript基础】之document.body和document.documentElement比较

    document.body和document.documentElement比较:

         document.body是DOM中Document对象里的body节点, document.documentElement是文档对象根节点(html)的引用。
         IE在怪异模型(quick mode)下document.documentElement无法正确取到clietHeight scrollHeight等值,比如clietHeight=0。可以见IE的怪异模型并没有把html作为盒子模型的一部分,好在现在很少使用怪异模 型。(注:如果页面没写DTD或写的不对,IE6默认使用怪异模型解析页面)

    document.body.scrollHeight和document.documentElement.scrollHeight的区别:

         document.body.scrollHeight是body元素的滚动高 度,document.documentElement.scrollHeight为页面的滚动高度,且 document.documentElement.scrollHeight在IE和Firefox下还有点小差异。
         IE : document.documentElement.scrollHeight = document.body.scrollHeight + marginTop bottom高度 + 上下border宽度
         firefox : document.documentElement.scrollHeight = document.body.scrollHeight + marginTop bottom高度

  • 相关阅读:
    toj 2975 Encription
    poj 1797 Heavy Transportation
    toj 2971 Rotating Numbers
    zoj 2281 Way to Freedom
    toj 2483 Nasty Hacks
    toj 2972 MOVING DHAKA
    toj 2696 Collecting Beepers
    toj 2970 Hackle Number
    toj 2485 Card Tric
    js页面定位,相关几个属性
  • 原文地址:https://www.cnblogs.com/sniper007/p/2303215.html
Copyright © 2011-2022 走看看