欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

日历My97DatePicker绑定 博客分类: js-jquery My97DatePicker

程序员文章站 2024-03-11 12:38:31
...
1 绑定日期
导入My97DatePicker/WdatePicker.js
body中加入:
<input type="text" id="date" name="date" class="Wdate" onfocus="WdatePicker()" readonly="readonly" />

2 绑定类似开始日期-结束日期
导入My97DatePicker/WdatePicker.js
<script type="text/javascript">
function controlDate(){
    var date1 = document.getElementById("startTime").value;
    if (date1!="") {
	var year = date1.substr(0,4);
	var month_1 = date1.substr(5,1);
	var month_2 = date1.substr(6,1);
	var last ;
	if (month_1=="0") {
		last = year+'-'+(parseInt(month_2)+1)+'-01';
	}else {
		last = year+'-'+(parseInt(month_1+month_2)+1)+'-01';
	}
	document.getElementById("lastDate").value=last;
	WdatePicker({minDate:'#F{$dp.$D(\'startTime\',{d:2});}',maxDate:'#F{$dp.$D(\'lastDate\',{d:-1});}'});
    }else {
	WdatePicker();
    }
 }
</script>

body中加入:
<input type="text" id="startTime" name="startTime" class="Wdate" onfocus="WdatePicker()" readonly="readonly" />&nbsp;&nbsp;-
<input type="hidden" id="lastDate" />
<input type="text" id="endTime" name="endTime" class="Wdate" onfocus="WdatePicker({minDate:'#F{$dp.$D(\'startTime\',{d:1});}'});" readonly="readonly" />
相关标签: My97DatePicker