我想在集中文本框时弹出一个日历控件。除日历控件未显示外,一切都在起作用。
代码:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="https://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$('#txt_date').datepicker();
})
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="txt_date" Class="txt_date" runat="server"></asp:TextBox>
</div>
</form>
</body>
</html>
您还需要包括jqueryui
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<link rel="stylesheet" href="/resources/demos/style.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script> <--This is path to jqueryUI
$( function() {
$( "#txt_date" ).datepicker();
} );
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="txt_date" Class="txt_date" runat="server"></asp:TextBox>
</div>
</form>
</body>
</html>