html:
<input type="text" value="" placeholder="请输入开始日期"comments="开始时间" id="kssj" name="kssj" οnclick="var date=zdyM('KS');var date2=zdyM('JS');WdatePicker({minDate:date,maxDate:date2})">
jQuery:
function zdyM(lx){
var endtime="";
//判断每月的天数
var monthtotal ="";//每月的总天数
var month=$("select[name='WYY_RSC_JBHZSQ.yf'] option:selected").val();//月
var year =$("select[name='WYY_RSC_JBHZSQ.nf'] option:selected").val();//年
if(month==2){
monthtotal=28
}
if(month==4||month==6||month==9||month==11){
monthtotal=30
}
if(month==1||month==3||month==5||month==7||month==8||month==10){
monthtotal=31
}
console.log("//月份为:"+month+"//天数:"+monthtotal)
if(lx=="JS"){
endtime=year+'-'+month+'-'+monthtotal;
}
if(lx=="KS"){
endtime=year+'-'+month+'-'+"1";
}
console.log("//获得日期为:"+endtime)
return endtime;
}