我在点击输入文本框时创建了一个下拉日历。
我之后一直试图建模(https://www.tutorialspoint.com/jqueryui/jqueryui_datepicker.htm)。
我已经使用NuGet Package Manager安装了jQuery UI。虽然你看到的
以外没有其他的导入到jquery。有人请帮我直截了当吗? <script>
src=...
整个Test.cshtml文件
<script>
编辑1: 该网站正在部署在Intranet网络上。
这是Layout.cshtml
@{
ViewBag.Title = "Test";
}
<h2>Test</h2>
<div>
<!-- Javascript -->
<script>
$(function() {
$( "#datepicker-1" ).datepicker();
});
</script>
<!-- HTML -->
<p>Enter Date: <input type="text" id="datepicker-1"></p>
</div>
<!DOCTYPE html>
<html>
<head>
@using System.Security.Principal
@using CalcPayment_WebApp.Models.ViewModels
@using CalcPayment_WebApp.Models.DataBase
@using System.Linq
<meta charset="UTF-8">
<meta name="google" content="notranslate">
<meta http-equiv="Content-Language" content="en">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title - Some Company</title>
<link rel="stylesheet" type="text/css" href="~/Content/StyleSheet.css">
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
@{
WindowsIdentity identity = HttpContext.Current.Request.LogonUserIdentity;
CheckIdentity(identity);
if (Session["isSysAdmin"] == null || (bool)Session["isSysAdmin"] != true)
{
//show stuff
}
}
@Html.ActionLink("Some Company", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
@{
if (Session["isSysAdmin"] != null && (bool) Session["isSysAdmin"] == true)
{
<li>@Html.ActionLink("Customers", "Index", "Customers")</li>
<li>@Html.ActionLink("Contact", "Contact", "Home")</li>
}
else
{
<li>@Html.ActionLink("Some Company", "Details", "Customers", new { id = Session["UserCID"] }, null)</li>
<li>@Html.ActionLink("Contact", "Contact", "Home")</li>
}
}
</ul>
</div>
</div>
</div>
<div class="container body-content">
@RenderBody()
<hr />
<footer>
<p>© @DateTime.Now.Year - Some Company</p>
</footer>
</div>
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
@RenderSection("scripts", required: false)
<!--Found at https://www.w3schools.com/howto/tryit.asp?filename=tryhow_js_sort_table Used for sorting tables-->
<script>
function sortTable(column,targetTable) {
var table, rows, switching, i, x, y, shouldSwitch;
table = document.getElementById(targetTable);
switching = true;
/*Make a loop that will continue until
no switching has been done:*/
while (switching) {
//start by saying: no switching is done:
switching = false;
rows = table.getElementsByTagName("TR");
/*Loop through all table rows (except the
first, which contains table headers):*/
for (i = 1; i < (rows.length - 1); i++) {
//start by saying there should be no switching:
shouldSwitch = false;
/*Get the two elements you want to compare,
one from current row and one from the next:*/
x = rows[i].getElementsByTagName("TD")[column];
y = rows[i + 1].getElementsByTagName("TD")[column];
//check if the two rows should switch place:
if (x.innerHTML.toLowerCase() > y.innerHTML.toLowerCase()) {
//if so, mark as a switch and break the loop:
shouldSwitch = true;
break;
}
}
if (shouldSwitch) {
/*If a switch has been marked, make the switch
and mark that a switch has been done:*/
rows[i].parentNode.insertBefore(rows[i + 1], rows[i]);
switching = true;
}
}
}
</script>
@functions {
public void CheckIdentity(WindowsIdentity identity)
{
//Check user identity
}
}
</body>
</html>