0

我不是 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 之外的所有浏览器上运行并正确显示。第二个脚本在所有浏览器上运行,因此它看起来不像是权限问题。

对于这方面的任何帮助,我将不胜感激。谢谢。

4

1 回答 1

1

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

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

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

于 2013-05-09T16:35:02.490 回答