繁体   English   中英

页面有两个脚本。 一种可以在所有浏览器上运行。 IE7失败了。

[英]Page has two scripts. One runs on all browsers. One fails on IE7.

我不是js专家,但我已将错误的脚本最小化,并尝试将故障本地化而没有成功。 您可以在www.trinitywoking.org.uk上找到实际的页面。 但我的最小测试用例是

<!DOCTYPE html>
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="content-type">
<title>MinTestCase</title>
<script>window.onload = function () { // Don't run script until page is loaded
var votd = new Array();  
votd[129]="Mount Sinai was all smoke because God had come down on it as fire.";
// Prepare today's string for display
document.getElementById("keyverse").innerHTML="<p> "  +  votd[(129)] + "</p> ";
}
</script>
</head>
<body>
<h1>Target paragraph follows </h1>
<p id="keyverse">
</p>  
</body>
</html>

它会在IE lte 8以外的所有浏览器上运行并正确显示。第二个脚本在所有浏览器上运行,因此它看起来不会出现权限问题。

我将非常感谢您对此提供的任何帮助。 谢谢。

删除document.getElementById()行中的<p>标记:

document.getElementById("keyverse").innerHTML=votd[(129)];

您已经尝试在标签中编辑innerHTML IE是一个非常挑剔的浏览器。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM