mvc 如何使用母版页
_layout.cshtml文件定义如下:<!DOCTYPE html><html><head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width" /> <title>@ViewBag.Title</title> @Styles.Render("~/Content/css") @Scripts.Render("~/bundles/modernizr") <script src="~/Scripts/jquery_easyUI/easyloader.js"></script> <script src="~/Scripts/jquery_easyUI/jquery.easyui.min.js"></script> <script src="~/Scripts/jquery_easyUI/jquery.easyui.mobile.js"></script> <script src="~/Scripts/jquery_easyUI/jquery.min.js"></script> <script src="~/Scripts/jquery-1.8.2.min.js"></script> <script src="~/Scripts/jquery-1.8.2.js"></script> @*<script src="~/Scripts/jquery-1.8.2.intellisense.js"></script>*@ <script src="~/Scripts/jquery.unobtrusive-ajax.min.js"></script> @RenderSection("scripts", required: true) </head><body> @*@Scripts.Render("~/bundles/jquery")*@@*@RenderSection("scripts", required: false)*@ @RenderBody()</body></html>
index.cshtml文件定义如下:
<!DOCTYPE html> <html><head> <title>@ViewBag.Title</title> <link href="~/Content/themes/login.css" rel="stylesheet" /> @section scripts{<script type="text/javascript"> function changeCheckCode() { //alert($("a")); $("#img").attr("src", $("#img").attr("src") + 1); } function afterLogin(data) { alert(data);} </script> }</head><body> </body></html>
运行时出现如下错误:行: 10错误: “jQuery”未定义就是index.cshtml页的这句 $("#img").attr("src", $("#img").attr("src") + 1);这是怎么回事呢?