<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>My97DatePicker日期控件使用</title>
<style type="text/css">
.sTime,.eTime{display:inline-block;width:100px;line-height:30px;border-bottom:1px solid #333;}
</style>
<script type="text/javascript" class="lazyload" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB/AAffA0nNPuCLAAAAAElFTkSuQmCC" data-original="js/jquery.js"></script>
<script type="text/javascript">
$(function(){
//日期显示当月
(function(){
var date=new Date;
var year=date.getFullYear();
var month=date.getMonth()+1;
month =(month<10 ? "0"+month:month);
var mydate = (year.toString()+'-'+month.toString());
$('.startTime').val(mydate);
$('.endTime').val(mydate);
})();
})
</script>
</head>
<body>
<center>
<h2>My97DatePicker日期控件的使用</h2>
</center>
开始,结束日期:<!-- $dp.$ 相当于 document.getElementById 函数. -->
<input id="sdate" class="Wdate startTime" name="startTime" onfocus="WdatePicker({dateFmt:'yyyy-MM',isShowClear:false,isShowToday:false,isShowOK:false,readOnly:true,maxDate:'#F{$dp.$D(\'edate\')}',onpicked:pickedSdate})" />
<i class="timeLine">至</i>
<input id="edate" class="Wdate endTime" name="endTime" onfocus="WdatePicker({dateFmt:'yyyy-MM',isShowClear:false,isShowToday:false,isShowOK:false,readOnly:true,minDate:'#F{$dp.$D(\'sdate\')}',startDate:'#F{$dp.$D(\'sdate\',{d:+1})}',onpicked:pickedSdate})" />
<!--
isShowToday:true/false今天是否显示
isShowClear:true/false清空是否显示
isShowOK:true/false确定按钮不显示
onpicked:pickedFunc点击事件
-->
<div>
<p>开始时间:<span class="sTime"></span></p>
<p>结束时间:<span class="eTime"></span></p>
</div>
</body>
<script type="text/javascript" class="lazyload" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB/AAffA0nNPuCLAAAAAElFTkSuQmCC" data-original="js/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript">
//获取选中的值
function pickedSdate(){
var _val = this.value,
_name = this.name;
if(_name =='startTime'){
$('.sTime').text(_val);
}else if(_name =='endTime'){
$('.eTime').text(_val);
}
//执行统一搜索
};
</script>
</html>
共同学习,写下你的评论
评论加载中...
作者其他优质文章