mvc view 中 js 不反应

 <!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Title</title>
<link href="/Content/Songsen/css.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="/Script/Songsen/jquery-1.9.1.js"></script>
@RenderSection("script",false)
</head>
<body> </body>
</html>

当把@RenderSection("script",false) 写在母版页的<head>标签里时,在view里@section script{}里面的js应该写在

$(document).ready();里面。

 @section script
{
<script type="text/javascript" src="/Script/Songsen/jquery-1.9.1.js"></script>
<script type="text/javascript" src="/Script/Manager.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$("form").submit(function (e) {
alert("nihao");
});
});
</script>
}
上一篇:C#连接数据库SQL,并转换成list形式


下一篇:Java正则表达式实用教程