Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/378.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 页面有两个脚本。一个可以在所有浏览器上运行。一个在IE7上失败。_Javascript_Internet Explorer - Fatal编程技术网

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

Javascript 页面有两个脚本。一个可以在所有浏览器上运行。一个在IE7上失败。,javascript,internet-explorer,Javascript,Internet Explorer,我不是js专家,但我已经最小化了我的错误脚本,并试图定位错误,但没有成功。您可以在www.trinitywoking.org.uk上找到实际页面。但我的最小测试用例是 <!DOCTYPE html> <html> <head> <meta content="text/html; charset=utf-8" http-equiv="content-type"> <title>MinTestCase</title> <s

我不是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>

薄荷糖
window.onload=function(){//在加载页面之前不要运行脚本
var votd=新数组();
votd[129]=“西奈山全是烟,因为上帝像火一样降临在它上面。”;
//准备今天要显示的字符串
document.getElementById(“keyverse”).innerHTML=“”+votd[(129)]+”

”; } 目标段落如下

这在除IE lte 8之外的所有浏览器上都能正确运行和显示。 第二个脚本在所有浏览器上运行,因此看起来不像是权限问题

我将非常感谢你在这方面的帮助。
谢谢。

删除
文档中的
标记。getElementById()
行:

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

您试图编辑
innerHTML
的标记已经存在。IE是一个非常挑剔的浏览器。

我很确定这是微软的亵渎过滤器在起作用吗?你试过调试这个问题,看看是否有错误吗?您试图将
放在
中,这是无效的。我只能看到一个JavaScript函数非常感谢@imulsion。当然这很明显,我应该踢自己。当我解决这个问题时,min测试用例运行得非常好。我在的同一行上重复了一个非常类似的错误,但我应该能够很容易地进行排序。@user2366463没问题,这就是我在这里的目的:)我们都有这些“踢自己”的问题;我自己也吃过一些;)