日期:2014-05-16 浏览次数:20520 次
<script src="http://www.my97.net/dp/My97DatePicker/WdatePicker.js"></script>
<input id="d1" >
<div id="div1"></div>
<input id="d2" >
<script>
WdatePicker({eCont:'div1',doubleCalendar:true,onpicked:change })
function dateBA( date){
var d=date.match(/\d+/g);
d=new Date(d[0],d[1]-1,d[2]);
return [ fmt(d,-1),fmt(d,1) ]
function fmt(d,v){return new Date(d *1+v*864E5) .toLocaleDateString().slice(5) }
}
function change(){
var ds=dateBA(this.realValue);
$dp.$('d1').value=ds[0]
$dp.$('d2').value=ds[1]
}
</script>
<script src="http://www.my97.net/dp/My97DatePicker/WdatePicker.js"></script>
<p>输入日期<input id="d1" onclick="WdatePicker({onpicked:function(dp){var t=new Date($dp.cal.getNewDateStr().replace(/-/g,'/'));t.setDate(t.getDate()+1);$dp.$('d2').value=t.toLocaleDateString().match(/\d+/g).join('-')}})"></p>
<p>自动输出<input id="d2" ></p>