0

所以,我有这个登录页面(见下面的代码)并且Document.ready不工作。是剧本的问题吗?我的代码中可能有一些东西会导致document.ready无法正常工作吗?

我试图通过我的 javascript 中的警报消息进行检查,但它们从未被击中。

@model OpenRoad.Web.Areas.Account.Models.LogOnModel
@using Combres.Mvc
<!doctype html>
<!--[if lt IE 7 ]> <html class="no-js ie6" lang="en"> <![endif]-->
<!--[if IE 7 ]>    <html class="no-js ie7" lang="en"> <![endif]-->
<!--[if IE 8 ]>    <html class="no-js ie8" lang="en"> <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!-->
<html class="no-js" lang="en">
<!--<![endif]-->
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title>@string.Format("{0} - {1}", OpenRoad.Web.ApplicationSettings.Title, "Logon")</title>
<meta name="description" content="" />
<meta name="author" content="" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />

<link rel="shortcut icon" href="/Content/images/favicon.ico" />

@Html.CombresLink("siteCss")
<link rel="stylesheet" type="text/css" href="@Url.Content("~/App_Themes/" +       OpenRoad.Web.ApplicationSettings.Theme + "/styles.css")" />    
 </head>
 <body class="login">

@{
     ViewBag.Title = "Log On";
}
@section scripts {
<script type ="text/javascript">
    $(document).ready(function () {
        alert('test');
        mixpanel.track("View Logon");
        if ($(".validation-summary-errors")[0]) {
            alert('Found with Length');
        };
    });
 }   
</script>
4

1 回答 1

1

假设你的 _Layout.cshtml 有这个:

     @Scripts.Render("~/bundles/jquery")
        @RenderSection("scripts", required: false)
    </body>
</html>

将@section 脚本更改为@section 脚本

于 2013-07-24T19:04:40.603 回答