第 5 行第 9 列处的 JavaScript 严重错误(未知源位置)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/23155927/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-28 00:26:55  来源:igfitidea点击:

JavaScript critical error at line 5, column 9 in (unknown source location)

javascripthtmlinternet-explorervisual-studio-2012internet-explorer-11

提问by user2208349

I am using visual studio 2012

我正在使用 Visual Studio 2012

I have this simple html page, not asp.net page:

我有这个简单的 html 页面,而不是 asp.net 页面

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Test Float</title>
    <link rel="stylesheet" href="Styles/style.css" />
</head>
<body>
    <div class="header"></div>
    <div class="slideBar"></div>
    <div class="content"></div>
    <div class="footer"></div>
</body>
</html>

I run it on google chrome. it works good.

我在谷歌浏览器上运行它。它运作良好。

when I debug it on internet explorer. I got this error:

当我在 Internet Explorer 上调试它时。我收到此错误:

enter image description here

在此处输入图片说明

Edit

编辑

For those who think that the sytle sheet is the problem. here is my style sheet

对于那些认为样式表是问题的人。这是我的样式表

html, body {
margin:0px;
height:100%;
}
.header {
    width:100%;
    height:20%;
    background-color:red;
}
.footer {
    width:100%;
    height:20%;
    background-color:green;
}
.slideBar {
    width:20%;
    height:60%;
    float:right;
    background-color:blue;
}
.content {
    width:80%;
    height:60%;
    background-color:yellow;
}

It is working very good on google chrome and mozilla. the code is very very simple. just that IE11 is not

它在 google chrome 和 mozilla 上运行良好。代码非常非常简单。只是 IE11 不是

Edit2

编辑2

After I added my html page link to the compatibility mode. I got this exception:

在我将我的 html 页面链接添加到兼容模式之后。我得到了这个例外:

enter image description here

在此处输入图片说明

回答by Frédéric Hamidi

Your browser is apparently running an add-on that injects scripts into loaded pages, and these scripts cause problems with IE11 (and 10).

您的浏览器显然正在运行一个将脚本注入加载页面的插件,这些脚本会导致 IE11(和 10)出现问题。

You can configure Visual Studio to run IE in safe mode by adding an iexplore -extoffentry to the Browse With list and setting it as default, as explained here.

您可以配置的Visual Studio在安全模式下通过添加到运行IEiexplore -extoff进入浏览方式列表并将其设置为默认值,如解释在这里

That said, I would recommend investigating which add-on is responsible for this situation, as it may have other adverse effects to your web usage (and to your privacy), and you may want to remove it if at all possible.

也就是说,我建议您调查是哪个附加组件造成了这种情况,因为它可能对您的网络使用(和您的隐私)产生其他不利影响,并且您可能希望尽可能将其删除。

回答by jedison

You are on MSIEv11. Just a guess, but you might need to turn Compatibility Mode ON. [link]http://windows.microsoft.com/en-us/internet-explorer/use-compatibility-view#ie=ie-11
You set that your page/website should have Compatibility View. Tap or click the Tools button Tools, and then tap or click Compatibility View settings. Under Add this website, enter the URL of the site you want to add to the list, and then tap or click Add.

您使用的是 MSIEv11。只是猜测,但您可能需要打开兼容模式。[链接] http://windows.microsoft.com/en-us/internet-explorer/use-compatibility-view#ie=ie-11
你设置你的页面/网站应该有兼容性视图。点击或单击工具按钮工具,然后点击或单击兼容性视图设置。在“添加此网站”下,输入要添加到列表中的站点的 URL,然后点击或单击“添加”。

回答by Coskun Ozogul

I just want to share my experience, in my case, I was using lambda expressions to find some elements in a list like

我只想分享我的经验,就我而言,我使用 lambda 表达式在列表中查找一些元素,例如

myList.find(ro => ro.field1 == field1); 

And internet explorer doesn't support lambda expressions.

并且 Internet Explorer 不支持 lambda 表达式。

I created some functions in order to find items.

我创建了一些函数来查找项目。

It works.

有用。