<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
#div1{width:1600px;}#div2{position:absolute;left:20px;top:600px; background:red; width:100px;height:100px; float:left}</style>
</head><body>
<div id="div1">-</div>
<div id="div2"></div></body>
</html>
<script type="text/javascript">var elem = document.getElementById("div2");var left = posX(elem);var x ; window.onscroll = function()
{
x = left + scrollX();
setX(elem,x);}function getStyle( elem, name ) {    if (elem.style[name])
        return elem.style[name];    else if (elem.currentStyle)
        return elem.currentStyle[name];    else if (document.defaultView && document.defaultView.getComputedStyle) {
  
        name = name.replace(/([A-Z])/g,"-$1");
        name = name.toLowerCase();
 
        var s = document.defaultView.getComputedStyle(elem,"");
        return s && s.getPropertyValue(name);    } else
    return null;
}function posX(elem) {
    return parseInt( getStyle( elem, "left" ) );
}function setX(elem, pos) {    elem.style.left = pos + "px";
}function scrollX() {    var de = document.documentElement;    return self.pageXOffset ||
    
        ( de && de.scrollLeft ) ||
    
        document.body.scrollLeft;
}</script>

解决方案 »

  1.   

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    <style type="text/css">
    #div1{width:1600px;}#div2{position:fixed;left:20px;top:600px; background:red; width:100px;height:100px; float:left}
    </style>
    </head>
    <body>
    <div id="div1">-</div>
    <div id="div2"></div>
    </body>
    </html>
    -----
    这个更简单,不过ie6不支持.firefox可以
      

  2.   

    http://www.gucci.com/us/campaign/timepieces/ 用ie6并不能正常浏览
    如果用第一种兼容所有浏览器的定位方式,肯定会出现抖动
    第2种方式则不会,当然这样要放弃ie6的用户.
    另外上面写在样式里的float:left都可以去掉
      

  3.   

    http://www.gucci.com/us/campaign/timepieces/在IE6.0可以正常看的。
    不用兼容太多的浏览器,IE6.0支持就可以,主要为ie的用户。
      

  4.   

    我用http://www.gucci.com/us/campaign/timepieces/的源码直接用了,比较复杂,就不贴出来了。要用的朋友到这个网址看看IE点出来的源文件。