jquery datepicker日期控件用法

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1.Default" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<script src="/Script/jquery-1.10.2.js"></script>
<link rel="stylesheet" href="/css/ui-lightness/jquery-ui-1.10.4.custom.css">
<script src="/Script/jquery-ui-1.10.4.custom.js"></script>
<script>
$(function () {
$("#datepicker").datepicker();
$("#datepicker").datepicker("option", "dateFormat", "yy-mm-dd");
$("#ui-datepicker-div").css(‘font-size‘, ‘12px‘);


$("#btnAdd").click(function () {
var date = $("#datepicker").val();
var datetime = GetDatetime(date);
$.ajax({
type: "POST",
url: "/ajax/profile.ashx",
data: "ajaxMethod=tmptest&datetime=" + datetime,
success: function (msg) {
alert(datetime);
}
});
});
});

/*由日期获取随机时间*/
function GetDatetime(date) {
var h = parseInt(Math.random() * (23 - 6 + 1) + 6);//x上限,y下限
var m = parseInt(Math.random() * (59 - 1 + 1) + 1);
var s = parseInt(Math.random() * (59 - 1 + 1) + 1);
var datetime = date + " " + h + ":" + m + ":" + s;
return datetime;
}
</script>
</head>
<body>

<p>Date: <input type="text" id="datepicker"/></p>

<input type="button" id="btnAdd" value="测试"/>
</body>
</html>

jquery datepicker日期控件用法,古老的榕树,5-wow.com

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。