我正在运行这个脚本:
<script type="text/javascript">
window.onload=function()
{
document.getElementById("loading").style.display = "none";
}
</script>
当我实现它时,我的其他脚本在 IE 中停止工作(FF 和其他脚本工作正常)
为什么以及我应该做什么来解决这个问题?如果有更好的方法来执行上述脚本并消除问题,我正在使用 jQuery。
最佳答案
因为您已经在使用 jQuery,所以请这样做:
$(document).ready(function() {
document.getElementById("loading").style.display = "none";
});
或
$(document).ready(function() {
$("loading").style.display = "none";
});
请注意将其添加到 HMTL 文件的底部。
关于javascript - Windows Onload 导致脚本在 IE 中停止工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7952583/