我有一个MVC 3网络应用程序,其中我也使用一些jquery ui来显示按钮点击的几个对话框。我有一个共享布局,里面有3个局部。每个部分都有一些jquery,它设置了所需的ui对话框等。在每个$(document).ready函数中,我插入一个警告来证明每个都在实际触发。然而在它的最后...页面是完全空白的...什么也没有显示......此时我不知道接下来该做什么。如果我注释掉所有jquery ui代码...然后html显示...并显示......它显然显示不正确,因为现在缺少jquery ui代码。因此,对话框显示了......按钮和所有内容......但它们不起作用。
如果有人对我应该怎么做有任何建议......请告诉我。我尝试过的其他事情是......卸载......重新安装IE。使用chrome ...使用CDN传递jquery文件......路由似乎都很好...... global.asax没有任何问题。
任何?
我已将代码调整为适合以下页面。
<!DOCTYPE html>
<html>
<head>
<title>@ViewBag.Title</title>
@*<script src="@Url.Content("~/Scripts/jquery-1.6.2.min.js")" type="text/javascript"></script>*@
<link href="@Url.Content("~/Content/css/reset.css")" rel="stylesheet" type="text/css" />
<link href="@Url.Content( "~/Content/css/layout.css")" rel="stylesheet" type="text/css" />
<link href="@Url.Content("~/Content/css/jquery-ui-1.8.16.custom.css")" rel="stylesheet" type="text/css" />
<link href="@Url.Content( "~/Content/css/style.css" )" rel="stylesheet" type="text/css" />
@* jquery *@
<script src="@Url.Content("~/Scripts/jquery-1.7.1.js")" type="text/javascript"></script>
@*<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.1.js" type="text/javascript"></script>*@
@* jquery UI *@
<script src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.16/jquery-ui.js" type="text/javascript"></script>
@*<script src="@Url.Content("http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.16/jquery-ui.js")" type="text/javascript"></script>*@
<script type="text/javascript">
$(document).ready(function () {
$("#user-login-dialog").dialog({
autoOpen: false,
height: 'auto',
width: 'auto',
modal: true,
draggable: false,
resizable: false,
position: 'center',
close: function () { }
});
$("#sp-login-dialog").dialog({
autoOpen: false,
height: 'auto',
width: 'auto',
modal: true,
draggable: false,
resizable: false,
position: 'center',
close: function () { }
});
$("#create-user").button().click(function () {
$("#user-login-dialog").dialog("open");
});
$(document).ready("#create-service-provider").button().click(function () {
$("#sp-login-dialog").dialog("open");
});
$('#btnGo').bind('click', function () {
alert('User clicked button');
});
$(document).ready("#sp-login").button().click(function () {
$("#sp-login-form").submit();
});
$("#user-login").button().click(function () {
$("#user-login-form").submit();
});
});
</script>
</head>
<body>
<div id="doc2" class="yui-t7">
<div id="hd" class="center"><h1 id="logo"><a href="./" title="[Go to homepage]"><img src="@Url.Content( "~/Content/bah.png" )" /></a></h1></div>
<div class="center" style="margin-bottom: 20px;">
@if ( User.Identity.IsAuthenticated )
{
<span>@Html.ActionLink( "Logout" , "LogOff" , "Account" )</span>
}
else
{
<span>@Html.ActionLink( "Login" , "LogOn" , "Account" )</span>
}
</div>
<div id="bd">
<div id="yui-main" class="green">
<div class="yui-b">
<div class="yui-g">
@*this is the renderbody*@
<div id="quicklink">
<button id="create-user">Users & Requests</button> | <button id="create-service-provider">Services & Providers</button>
</div>
<div id="sp-login-dialog" title="Login or Register as a Service Provider">
<div class="main">
<div class="left">
<span>Need an account?:</span>
<ul>
<li>@Html.ActionLink("Register", "Register", "Account")</li>
<li>@Html.ActionLink("Register with Facebook", "FacebookRegistration", "ServiceProvider")</li>
</ul>
</div>
<div class="right">
<span>Already have an account?</span>
@using (Html.BeginForm("LogOn", "Account", FormMethod.Post, new { @name = "sp-login-form", @id = "sp-login-form" }))
{
<fieldset style="margin: 10px 0 0 0;">
<label for="name">
Username</label>
<input type="text" name="name" id="name" class="text ui-widget-content ui-corner-all" />
<label for="password">
Password</label>
<input type="password" name="password" id="password" value="" class="text ui-widget-content ui-corner-all" />
</fieldset>
}
<a class="fb_button fb_button_medium" href="@Url.Action("FacebookRegistration", "ServiceProvider")">
<span class="fb_button_text">Facebook Login</span>
</a>
<button style="margin: 0 0 0 5px;" id="sp-login">
Login</button>
</div>
</div>
</div>
<div id="user-login-dialog" title="Login or Register">
<div class="main">
<div class="left">
<span>Need an account?:</span>
<ul>
<li>@Html.ActionLink("Register", "Register", "Account")</li>
<li>@Html.ActionLink("Register with Facebook", "FacebookRegistration", "Account")</li>
</ul>
</div>
<div class="right">
<span>Already have an account?</span>
@using (Html.BeginForm("LogOn", "Account", FormMethod.Post, new { @name = "user-login-form", @id = "user-login-form" }))
{
<fieldset style="margin: 10px 0 0 0;">
<label for="name">
Username</label>
<input type="text" name="name" id="name" class="text ui-widget-content ui-corner-all" />
<label for="password">
Password</label>
<input type="password" name="password" id="password" value="" class="text ui-widget-content ui-corner-all" />
</fieldset>
}
<a class="fb_button fb_button_medium" href="@Url.Action("FacebookRegistration", "Account")">
<span class="fb_button_text">Facebook Login</span>
</a>
<button style="margin: 0 0 0 5px;" id="user-login">
Login</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="yui-b">
<!-- PUT SECONDARY COLUMN CODE HERE -->
</div>
</div>
<div id="ft" class=" center">
<p class="f-right">
@Html.ActionLink("Home", "Index", "Home")
<span>|</span>
@Html.ActionLink("About", "About", "Home")
<span>|</span>
@Html.ActionLink("Support", "Support", "Home")
<span>|</span>
@Html.ActionLink("Contact Us", "Contact", "Home")
<span>|</span>
<a href="/">Riebro</a>
</p>
<p class="small">Copyright © @DateTime.Now.Year <strong><a href="#">bah</a></strong>, All Rights Reserved ®</p>
</div>
</div>
</body>