首页 > Web开发 > 详细

jquery datepicker日期控件用法

时间:2014-06-28 10:37:57      阅读:368      评论:0      收藏:0      [点我收藏+]

<%@ 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日期控件用法,布布扣,bubuko.com

jquery datepicker日期控件用法

原文:http://www.cnblogs.com/niaowo/p/3804152.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!