ie6很奇怪的现象

cloudgamer 2009-07-09 11:49:28
<!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
...全文
131 14 打赏 收藏 转发到动态 举报
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
浪尖赏花 2009-07-09
  • 打赏
  • 举报
回复
<!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>
natineprince 2009-07-09
  • 打赏
  • 举报
回复
IE6的innerHTML好像只要赋值了就会有流重写.
前面还见过的有把for循环终止掉.因为有流重写.
cloudgamer 2009-07-09
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 junyi2003 的回复:]
IE6这类小BUG多了去咯。
见怪不怪
[/Quote]

至少这个我是第一次见
cb1156 2009-07-09
  • 打赏
  • 举报
回复
额。。。
。奇怪啊...
junyi2003 2009-07-09
  • 打赏
  • 举报
回复
IE6这类小BUG多了去咯。
见怪不怪
jol_boy 2009-07-09
  • 打赏
  • 举报
回复
的确!不清楚为什么
cloudgamer 2009-07-09
  • 打赏
  • 举报
回复
[Quote=引用 12 楼 dh20156 的回复:]
这可能就是这个BUG的问题所在了,它可能没有记录页面初始化时候的状态,重绘都只是根据当前页面状态来做了 ^_^
[/Quote]

不知有没有牛人研究过这个
对这个挺有兴趣
说不定以后ie6兼容fixed又有新方法
natineprince 2009-07-09
  • 打赏
  • 举报
回复
不过其实我觉得IE的这个设置还更合理些...
dh20156 2009-07-09
  • 打赏
  • 举报
回复
这可能就是这个BUG的问题所在了,它可能没有记录页面初始化时候的状态,重绘都只是根据当前页面状态来做了 ^_^
cloudgamer 2009-07-09
  • 打赏
  • 举报
回复
[Quote=引用 7 楼 dh20156 的回复:]
Reflow
[/Quote]

看了无忧的回帖
你说的应该没错
为什么重绘之后right 和bottom 会对应到当前的视窗了呢
cloudgamer 2009-07-09
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 natineprince 的回复:]
IE6的innerHTML好像只要赋值了就会有流重写.
前面还见过的有把for循环终止掉.因为有流重写.
[/Quote]

估计是Reflow的问题
但这个也特殊了点
因为
window.onscroll = function(){
a.style.right = '0';
a.style.bottom = '0';
}
就算了是这样显然也做不到出现的效果
但innerHTML却能做到,这才是最奇怪的地方
cloudgamer 2009-07-09
  • 打赏
  • 举报
回复
[Quote=引用 8 楼 sunxing007 的回复:]
我也说几个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>"可以。
[/Quote]

这些还好
因为是结构问题,还算有依据
sunxing007 2009-07-09
  • 打赏
  • 举报
回复
我也说几个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>"可以。
dh20156 2009-07-09
  • 打赏
  • 举报
回复
Reflow

87,907

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧