【发布时间】:2011-01-06 21:22:08
【问题描述】:
在我正在开发的网站上,我加载了一系列图像,这些图像可以使用我用 JavaScript 实现的一些控件进行动画处理。在所有浏览器中一切正常,但 IE6 锁定并且永远不会恢复;至少在我让它坐在那里的 15 分钟内不会。
它窒息的部分是我尝试修改特定 div 内容的部分。
问题之前:
<div id='animation_image'></div>
问题后:
<div id="animation_image">
<div id="daily_loop_image_13" class="loop_image">
<img name="animation" src="/path/to/image/13/20100119/world_14.gif"
class="hiddenElements" border="0">
</div>
<div id="daily_loop_image_12" class="loop_image">
<img name="animation" src="/path/to/image/12/20100119/world_13.gif"
class="hiddenElements" border="0">
</div>
<div id="daily_loop_image_11" class="loop_image">
<img name="animation" src="/path/to/image/11/20100119/world_12.gif"
class="hiddenElements" border="0">
</div>
<div id="daily_loop_image_10" class="loop_image">
<img name="animation" src="/path/to/image/10/20100119/world_11.gif"
class="hiddenElements" border="0">
</div>
<div id="daily_loop_image_9" class="loop_image">
<img name="animation" src="/path/to/image/9/20100119/world_10.gif"
class="hiddenElements" border="0">
</div>
<div id="daily_loop_image_8" class="loop_image">
<img name="animation" src="/path/to/image/8/20100119/world_9.gif"
class="hiddenElements" border="0">
</div>
<div id="daily_loop_image_7" class="loop_image">
<img name="animation" src="/path/to/image/7/20100119/world_8.gif"
class="hiddenElements" border="0">
</div>
<div id="daily_loop_image_6" class="loop_image">
<img name="animation" src="/path/to/image/6/20100119/world_7.gif"
class="hiddenElements" border="0">
</div>
<div id="daily_loop_image_5" class="loop_image">
<img name="animation" src="/path/to/image/5/20100119/world_6.gif"
class="hiddenElements" border="0">
</div>
<div id="daily_loop_image_4" class="loop_image">
<img name="animation" src="/path/to/image/4/20100119/world_5.gif"
class="hiddenElements" border="0">
</div>
<div id="daily_loop_image_3" class="loop_image">
<img name="animation" src="/path/to/image/3/20100119/world_4.gif"
class="hiddenElements" border="0">
</div>
<div id="daily_loop_image_2" class="loop_image">
<img name="animation" src="/path/to/image/2/20100119/world_3.gif"
class="hiddenElements" border="0">
</div>
<div id="daily_loop_image_1" class="loop_image">
<img name="animation" src="/path/to/image/1/20100119/world_2.gif"
class="hiddenElements" border="0">
</div>
<div id="daily_loop_image_0" class="loop_image">
<img name="animation" src="/path/to/image/0/20100119/world_1.gif"
class="" border="0">
</div>
<div id="weekly_loop_image_1" class="loop_image">
<img name="animation" src="/path/to/weeklyImage/1/20100119/world_wk2max.gif"
class="hiddenElements" border="0">
</div>
<div id="weekly_loop_image_0" class="loop_image">
<img name="animation" src="/path/to/weeklyImage/0/20100119/world_wk1max.gif"
class="hiddenElements" border="0">
</div>
</div>
我试过了:
- 将所有带有animation_image的元素存储为字符串并将其设置为innerHTML
- 使用动画图像创建空/占位符 div 并单独填充它们
- 使用 appendChild 而不是 innerHTML
- 在“animation_image”下添加另一个 div,并使用上面的 3 种方法将所有图像/div 放入其中
它似乎在 IE6 中不起作用 - 所有方法在 FF3.0+、IE7+、Chrome 2+ 等中都可以正常工作。如果我在 innerHTML 之前退出 javascript 它工作正常但如果我什至尝试通过第二个要点中的方法填充单个 div(在 animation_image 内),它会锁定并且永远不会恢复。
我确定我遗漏了一些东西,但我完全吓坏了 ATM。提前致谢。
更新:这里是带有示例 XML (http://pastebin.com/m5b426a67) 的 javascript 链接
【问题讨论】:
-
发布 javascript。听起来你有一个只有 IE 会生成的无限循环。编辑:另外,您可能应该终止
-
我编辑了你的代码,因为没有人可以阅读它。
-
相关JS可以在这里找到:pastebin.com/m5b426a67我会相应地更新我的帖子。
-
感谢 KLE - 我尝试对其进行格式化,但遇到了代码块问题。
-
只是为了咯咯笑,我想看看使用 jQuery 加载函数是否会执行得更好 - 就动画图像中的 HTML 而言,最终结果与使用我的 javascript 解析例程生成的结果相同.我加载的 HTML 文件有我想要在我的站点中显示的 div 和 img 标签,没有其他任何东西,而且这个过程仍然慢得令人不安。我只是把它归结为 IE6 烂片还是我仍然做错了什么?
标签: javascript html internet-explorer-6 innerhtml