Javascript Internet Explorer 行 1 字符 1 代码 0 错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2133033/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Internet Explorer line 1 char 1 code 0 error
提问by Tigran Tokmajyan
I'm using jQuery+drupal and some jQuery plugins. All is ok with Firefox. But in IE's i'm receiving problem like this.
我正在使用 jQuery+drupal 和一些 jQuery 插件。Firefox 一切正常。但是在 IE 中,我收到了这样的问题。
Line: 1 Char: 1 Error: object expected URL: http://businessway.am
行:1 字符:1 错误:对象预期 URL:http: //businessway.am
I have included .js files. How to know where is the problem? In which file? Line 1? Which file?
我已经包含了 .js 文件。如何知道问题出在哪里?在哪个文件?1号线?哪个文件?
If you can please check site which I gave before.
如果可以,请查看我之前提供的站点。
采纳答案by Roland Bouman
You could get this type of errors in case the url of a <script src="...url..."></script>does not return javascript, but some other content (html)
如果 a 的 url<script src="...url..."></script>不返回 javascript,而是返回一些其他内容 (html),您可能会收到此类错误
I checked the page, but all scripts with src actually do seem to return javascript. With a bit more digging, it seems that this eval code triggers the error message:
我检查了页面,但所有带有 src 的脚本实际上似乎都返回了 javascript。多挖一点,这个 eval 代码似乎触发了错误消息:
artNoStyleAdding(document)
It looks like it is coming from this script:
看起来它来自这个脚本:
<script type="text/javascript">if (Drupal.jsEnabled) {$(document).ready(function(){ window.setTimeout("artNoStyleAdding(document)", 2000);});}</script>
That's the last but one script in the head of the document.
这是文档头部的最后一个脚本。
Apperantly you forgot to declare and code the artNoStyleAddingfunction, whatever it is supposed to do.
显然你忘了声明和编码artNoStyleAdding函数,不管它应该做什么。
回答by Brian Armstrong
I've seen this error come up in IE7 when you have a javascript object with an extra comma on the end.
当您有一个末尾带有额外逗号的 javascript 对象时,我已经看到 IE7 中出现此错误。
Example:
例子:
var something = {
"one": ["a"],
"two": ["b"],
};
Should be:
应该:
var something = {
"one": ["a"],
"two": ["b"]
};
IE8, Chrome, and Firefox don't seem to mind it though.
IE8、Chrome 和 Firefox 似乎并不介意。
回答by Jeremy
I had this exact same error, only in IE, when putting comments in a certain spot:
我有这个完全相同的错误,只有在 IE 中,当在某个位置放置评论时:
function initMyUI() {
$("#myId") // Don't put comments here.
.delegate("#btnMyButton", "click", _clickDoSomeThings);
};
回答by rfunduk
Depending on your version of IE you'll want to break out the development tools available. You can use Firebug Lite, built in dev tools in IE8 or go the old standby and use Web Developer Express.
根据您的 IE 版本,您可能希望打破可用的开发工具。您可以使用Firebug Lite,IE8 中内置的开发工具,或者使用旧的备用工具并使用Web Developer Express。
回答by Tigran Tokmajyan
The problem has been fixed in IE7 and IE8, but IE6 give's same error.
该问题已在 IE7 和 IE8 中修复,但 IE6 给出相同的错误。
Updated:Fixed. Sorry :)
更新:固定。对不起 :)

