写在单选按钮的状态改变事件:pDate1和pDate2是日期控件名字
var frm=this.options.form;
var nowDate = new Date();
var sel = this.getValue();
if(sel =="周"){ //周一
var week = nowDate.getDay()==0?7:nowDate.getDay();
nowDate.setDate(nowDate.getDate()- week + 1 );
frm.getWidgetByName("pDate1").setValue(nowDate);
frm.getWidgetByName("pDate2").setValue(nowDate);
}
else if(sel == "月"){ //月初
var nowMonth = nowDate.getMonth();
var nowYear = nowDate.getFullYear();
var monthStartDate = new Date(nowYear, nowMonth, 1);
frm.getWidgetByName("pDate1").setValue(monthStartDate);
frm.getWidgetByName("pDate2").setValue(monthStartDate);
}
else if(sel == "日") { //今天
frm.getWidgetByName("pDate1").setValue(nowDate);
frm.getWidgetByName("pDate2").setValue(nowDate);
}