点击w97日期控件自动取得所在星期几放到输入框
//js对象date的date.getDay()方法
function pFn(rq){ var d = convertDateFromString(rq); var weekday=new Array(7) /* weekday[0]="星期天"; weekday[1]="星期一"; weekday[2]="星期二"; weekday[3]="星期三"; weekday[4]="星期四"; weekday[5]="星期五"; weekday[6]="星期六"; */ weekday[0]="天"; weekday[1]="一"; weekday[2]="二"; weekday[3]="三"; weekday[4]="四"; weekday[5]="五"; weekday[6]="六"; //alert(weekday[d.getDay()]); $("#xq").val(weekday[d.getDay()]); } //输入字符串,返回date对象,格式yyyy-MM-dd function convertDateFromString(dateString) { if (dateString) { var date = new Date(dateString.replace(/-/, "/")) return date; } }
<input type="text" name="rq" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',onpicked:function(dp){pFn(dp.cal.getNewDateStr())}})" value="<fmt:formatDate value='${xxx.rq}' pattern='yyyy-MM-dd' />"/>