<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

这个使得符合W3C标准的页面无法使用onscroll事件,也就是说onscroll事件不符合W3C的标准。

许多直接把上面那条语句删掉,然后在body中这样写:

<body onscroll="

floater.style.top=document.body.scrollTop+document.body.clientHeight-oip.offsetHeight;

">

<div ></div>

floater的其他属性如颜色,宽度,高度可直接在css中写好。

这样的结果是onscroll事件可以执行,但我页面的格局却因为缺少那个W3C标准而被打乱了。所以。。。这个不能使用。

我使用下面的方法:

 <script type="text/javascript">
    function divMove()
    {
        
         var floater=document.getElementById("floater");//这条写不写都可以
         floater.style.top=document.documentElement.scrollTop+document.documentElement.clientHeight-floater.offsetHeight;
    }
    </script>  

 body代码为

 <body onload=" window.setInterval(divMove,150);">....这样就可以了

相关文章:

  • 2022-12-23
  • 2021-12-27
  • 2021-08-09
  • 2022-12-23
  • 2021-07-01
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-07-04
  • 2021-09-03
  • 2021-11-21
相关资源
相似解决方案