jquery.datetimepicker日期時間控件點擊彈出日期時間選擇器代碼



302 1206 403



特效描述:jquery.datetimepicker 日期時間控件 點擊彈出 日期時間選擇器,日期時間控件點擊彈出日期時間選擇器代碼

代碼結構

1. 引入CSS

<link rel="stylesheet" type="text/css" href="jquery.datetimepicker.css"/>

2. 引入JS

<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jquery.datetimepicker.js"></script>

3. HTML代碼

<div style="width:960px;margin:0 auto;">
	<h3>DateTimePicker</h3>
	<input type="text" value="2014/03/15 05:06" id="datetimepicker"/><br><br>
	<h3>Mask DateTimePicker</h3>
	<input type="text" value="" id="datetimepicker_mask"/><br><br>
	<h3>TimePicker</h3>
	<input type="text" id="datetimepicker1"/><br><br>
	<h3>DatePicker</h3>
	<input type="text" id="datetimepicker2"/><br><br>
	<h3>Inline DateTimePicker</h3>
	<input type="text" id="datetimepicker3"/><input type="button" onClick="$('#datetimepicker3').datetimepicker({value:'2011/12/11 12:00'})" value="set inline value 2011/12/11 12:00"/><br><br>
	<h3>Button Trigger</h3>
	<input type="text" value="2013/12/03 18:00" id="datetimepicker4"/><input id="open" type="button" value="open"/><input id="close" type="button" value="close"/><input id="reset" type="button" value="reset"/>
	<h3>TimePicker allows time</h3>
	<input type="text" id="datetimepicker5"/><br><br>
	<h3>Destroy DateTimePicker</h3>
	<input type="text" id="datetimepicker6"/><input id="destroy" type="button" value="destroy"/>
	<h3>Set options runtime DateTimePicker</h3>
	<input type="text" id="datetimepicker7"/>
	<p>If select day is Saturday, the minimum set 11:00, otherwise 8:00</p>
	<h3>onGenerate</h3>
	<input type="text" id="datetimepicker8"/>
	<h3>disable all weekend</h3>
	<input type="text" id="datetimepicker9"/>
</div>	
<script type="text/javascript">
$('#datetimepicker_mask').datetimepicker({
	mask:'9999/19/39 29:59'
});
$('#datetimepicker').datetimepicker();
$('#datetimepicker').datetimepicker({value:'2015/04/15 05:03',step:10});
$('#datetimepicker1').datetimepicker({
	datepicker:false,
	format:'H:i',
	step:5
});
$('#datetimepicker2').datetimepicker({
	yearOffset:222,
	lang:'ch',
	timepicker:false,
	format:'d/m/Y',
	formatDate:'Y/m/d',
	minDate:'-1970/01/02', // yesterday is minimum date
	maxDate:'+1970/01/02' // and tommorow is maximum date calendar
});
$('#datetimepicker3').datetimepicker({
	inline:true
});
$('#datetimepicker4').datetimepicker();
$('#open').click(function(){
	$('#datetimepicker4').datetimepicker('show');
});
$('#close').click(function(){
	$('#datetimepicker4').datetimepicker('hide');
});
$('#reset').click(function(){
	$('#datetimepicker4').datetimepicker('reset');
});
$('#datetimepicker5').datetimepicker({
	datepicker:false,
	allowTimes:['12:00','13:00','15:00','17:00','17:05','17:20','19:00','20:00']
});
$('#datetimepicker6').datetimepicker();
$('#destroy').click(function(){
	if( $('#datetimepicker6').data('xdsoft_datetimepicker') ){
		$('#datetimepicker6').datetimepicker('destroy');
		this.value = 'create';
	}else{
		$('#datetimepicker6').datetimepicker();
		this.value = 'destroy';
	}
});
var logic = function( currentDateTime ){
	if( currentDateTime.getDay()==6 ){
		this.setOptions({
			minTime:'11:00'
		});
	}else
		this.setOptions({
			minTime:'8:00'
		});
};
$('#datetimepicker7').datetimepicker({
	onChangeDateTime:logic,
	onShow:logic
});
$('#datetimepicker8').datetimepicker({
	onGenerate:function( ct ){
		$(this).find('.xdsoft_date')
			.toggleClass('xdsoft_disabled');
	},
	minDate:'-1970/01/2',
	maxDate:'+1970/01/2',
	timepicker:false
});
$('#datetimepicker9').datetimepicker({
	onGenerate:function( ct ){
		$(this).find('.xdsoft_date.xdsoft_weekend')
			.addClass('xdsoft_disabled');
	},
	weekends:['01.01.2014','02.01.2014','03.01.2014','04.01.2014','05.01.2014','06.01.2014'],
	timepicker:false
});
</script>



用戶評論
大牛,別默默的看了,快登錄幫我點評一下吧!:)      登錄 | 注冊


熱門標簽: 滾動 滾動條 頁面滾動 滾動插件 滾動條插件 滾動條美化 自動滾動圖片輪播 彈出層拖動 窗口 彈出 彈窗 彈出層 提示框 對話框 遮罩 遮罩層 彈窗插件 切換按鈕 日期時間 時鐘 日歷 時間 日歷插件 時間日期插件 表單 表單美化 表單插件 表單美化插件 滾動切換 滾動條切換 日歷選擇器 時間選擇器 提示框/彈出層 時間日期插件 時間日期 下拉框 select下拉菜單 select美化 select美化框 按鈕控制
?
×
×

注冊

官方QQ群

掃描上面二維碼加微信群

官方QQ群

jQuery/js討論群
群號:642649996
Css3+Html5討論群
群號:322131262

加群請備注:從官網了解到

老夫子电子