2013中进行调试时出现Javascript错误

2013中进行调试时出现Javascript错误

本文介绍了在Visual Studio 2013中进行调试时出现Javascript错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚在VS2013中开辟了一个网站,当我运行调试器时,我收到了Javascript异常:

I've just opened up a website for the first time in VS2013 and I'm getting Javascript exceptions when I run debugger:

Unhandled exception at line 194, column 21 in http://localhost:49809/

0x800a1391 - JavaScript runtime error: '$' is undefined

以下是代码:

<script type="text/javascript">
      $(function () {
           $('#one').ContentSlider({
                width: '960px',
                height: '250px',
                speed: 400,
                easing: 'easeOutSine'
            });
      });
 </script>

点击继续我还有一个例外:

Click Continue and I get a further exception:

Unhandled exception at line 37, column 59140 in http://localhost:52306/27fadf043d464a019907842c2a5a764e/browserLink

0x800a139e - JavaScript runtime error: Syntax error, unrecognized expression: unsupported pseudo: plusone

这个网站在VS2012中没有问题,可以正常运行和调试。我怀疑它与引用远程Javascript块有关(< script src =// code.jquery.com/jquery-latest.min.jstype =text / javascript> ;< / script> < script type =text / javascriptsrc =// apis.google.com/js/plusone.js> )。我需要修改权限设置吗?

This website works fine live and debugs without issue in VS2012. I have a suspicion it's to do with referring to remote Javascript blocks (<script src="//code.jquery.com/jquery-latest.min.js" type="text/javascript"></script> and <script type="text/javascript" src="//apis.google.com/js/plusone.js">). Is there a permissions setting I need to amend?

我们非常感谢任何帮助。

Any help would be greatly appreciated.

Numb

推荐答案

看起来您的脚本管理器在主页的body标签中添加了jquery引用。
您将在母版页到达正文标记之前使用'$'符号放入自己的脚本并引用jquery。

It looks as though your script manager adds in the jquery reference in the body tag of a master page.You're putting in your own script and referencing jquery using the '$' symbol before the master page gets to the body tag.

移动自己的脚本脚本到了身体之后。如果您正在使用内容占位符,则将内容占位符移动到正文后面(而不是在head部分中)。

Just move your own script to after the body. If you're using a content placeholder then move the content placeholder after the body (and not in the 'head' section).

这篇关于在Visual Studio 2013中进行调试时出现Javascript错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 09:56