可能性の重複:
Why don't jQuery works in Microsoft Visual Studio 2010?Visual Studio 2010 MVC 2 WebプロジェクトでjQueryを追加するには?
我々はウェブのVisual Studio 2010のMVC 2 Webプロジェクトを作成し、今ではjQueryを使用してメニューや画像のスライドショーのスタイルを追加したいです。しかし、jQueryスクリプトファイルを追加すると、Visual Studioにはいくつかのエラーが返されます。jQueryファイルをリンクするための前提条件が適切に与えられています。しかし、エラーが新しいMVC2プロジェクトを作成するときにjqueryのを持っているScript
という名前のフォルダがあります
// code that we have used in jQuery //
function slideSwitch() {
var $active = $('#Left_Image DIV.active');
if ($active.length == 0) $active = $('#Left_Image DIV:last');
// use this to pull the divs in the order they appear in the markup
var $next = $active.next().length ? $active.next()
: $('#Left_Image DIV:first');
// uncomment below to pull the divs randomly
// var $sibs = $active.siblings();
// var rndNum = Math.floor(Math.random() * $sibs.length);
// var $next = $($sibs[ rndNum ]);
$active.addClass('last-active');
$next.css({ opacity: 0.0 })
.addClass('active')
.animate({ opacity: 1.0 }, 1000, function() {
$active.removeClass('active last-active');
});
}
$(function() {
setInterval("slideSwitch()", 5000);
});
// code in view master page //
<title><asp:ContentPlaceHolder ID="TitleContent" runat="server" /></title>
<link href="../../Content/NIPL.css" rel="Stylesheet" type="text/css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<script src="<%= Url.Content("~/Scripts/jquery-1.5.1.min.js") %>" type="text/javascript"></script>
<script src="../../Scripts/jquery-1.4.1-vsdoc.js" type="text/javascript"></script>
<script src="<%= Url.Content("~/Scripts/SlideShow.js") %>" type="text/javascript"></script>
ビルドエラーが発生しますか?それは正確に何と言いますか?または、ブラウザコンソールに表示されるエラーは何ですか? –
新しい質問をするのではなく、元の質問を更新してください。タグの下にある[編集]リンクをクリックすると、それを行うことができます。 –