我正在尝试在我的 MVC3 应用程序中实现一个模式对话框。现在我只是在摆弄它。这是我的代码:
@model AROrdering.Models.Category
@{
ViewBag.Title = "Browse";
Layout = null;
}
<html>
<head>
<title>test</title>
<link href="@Url.Content("~/Content/testbootstrap.css")" rel="stylesheet" type="text/css" />
<script src="@Url.Content("~/Scripts/testbootstrap.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/testjquery-1.9.1.js")" type="text/javascript"></script>
<script>
$(document).ready(function () {
$('#showGame').click(function () {
$('#gameModal').modal('show');
});
});
</script>
</head>
<body>
<div class="container">
<div id="gameModal" class="modal hide fade in">
<div class="modal-header">
<a class="close" data-dismiss="modal">×</a>
<h3>This is a Modal Heading</h3>
</div>
<div class="modal-body">
<h4>Text in a modal</h4>
<p>You can add some text here.</p>
</div>
<div class="modal-footer">
<a href="#" class="btn btn-primary">Call to action</a>
<a href="#" class="btn" data-dismiss="modal">Close</a>
</div>
</div>
<button id="showGame" class="btn btn-primary btn-large">Show Game Listing</button>
</div>
</body>
</html>
如果我在应用程序外部的纯 html 页面中实现这个精确的 html,模式对话框就可以工作。但是当我将代码移过来时,它不会。我正在使用相同的 css 和 javascript 文件。有谁知道为什么当我转移到 MVC3 时会中断?