<!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>
</head><body><style>
body{
height:2000px;
width:2000px;
}
#a{
width:300px;
height:100px;
background:red;
}
</style>
<script>
window.onload = function(){
var a = document.getElementById('a');
a.style.position = 'absolute';
a.style.right = '0';
a.style.bottom = '0';
window.onscroll = function(){
a.innerHTML = '';
}
}
</script>
<div id='a'></div></body>
</html>用a.innerHTML = '';就能实现随屏移动了
蓝色有人发现的,本人是第一次看到
谁解析一下注意是ie6

解决方案 »

  1.   

    IE6这类小BUG多了去咯。
    见怪不怪
      

  2.   

    IE6的innerHTML好像只要赋值了就会有流重写.
    前面还见过的有把for循环终止掉.因为有流重写.
      

  3.   

    <!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>
    </head><body><style>
    body{
    height:2000px;
    width:2000px;
    }
    #a{
    width:300px;
    height:100px;
    background:red;
    }
    </style>
    <script>
    window.onload = function(){
        var a = document.getElementById('a');
        a.style.position = 'absolute';
        a.style.right = '0';
        a.style.bottom = '0';
        window.onscroll = function(){
            //a.innerHTML = '';
            document.getElementById("b").innerHTML = "";//设其他的innerHTML效果一样,无语
        }
    }
    </script>
    <div id='a'></div>
    <div id="b"></div>
    </body>
    </html>
      

  4.   

    我也说几个innerHTML狠恶心的东西。
    tr.innerHTML = '<td>some text</td>'会出错。//但是td.innerHTML = "some text" 可以。
    <p>.innerHTML="<li>some text</li>"也会出错。
    <select>.innerHTML = "<option>some text</option"也会出错。//但是select.outerHTML = "<select>...</select>"可以。
      

  5.   


    估计是Reflow的问题
    但这个也特殊了点
    因为
    window.onscroll = function(){
    a.style.right = '0';
    a.style.bottom = '0';
    }
    就算了是这样显然也做不到出现的效果
    但innerHTML却能做到,这才是最奇怪的地方
      

  6.   


    看了无忧的回帖
    你说的应该没错
    为什么重绘之后right 和bottom 会对应到当前的视窗了呢
      

  7.   

    这可能就是这个BUG的问题所在了,它可能没有记录页面初始化时候的状态,重绘都只是根据当前页面状态来做了 ^_^
      

  8.   


    不知有没有牛人研究过这个
    对这个挺有兴趣
    说不定以后ie6兼容fixed又有新方法