public String genRqOpts() {
StringBuilder rtn = new StringBuilder("")
java.util.Date date = new java.util.Date()//获得当前系统时间
SimpleDateFormat simple = new SimpleDateFormat("yyyyMMdd")
String time = simple.format(date)
String cur_Y = time.substring(0,4)//年
String cur_M = time.substring(4,6)//月
String cur_D = time.substring(6,8)//日
Calendar calendar = Calendar.getInstance()//初始化对象
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd")
calendar.set(Integer.parseInt(cur_Y), Integer.parseInt(cur_M), Integer.parseInt(cur_D))
rtn.append("<select>")
for (int i=0i<30i++) {//获取页面上下拉选项
calendar.add(Calendar.DATE, -1)
String elRq = sdf.format(calendar.getTime())
rtn.append("<option value='")
rtn.append(elRq)
rtn.append("'>")
rtn.append(elRq)
rtn.append("</option>")
}
rtn.append("</select>")
return rtn.toString()
}
加个日历控件在单元格内开发工具--->插入--->更多工具
选择Microsoft data and Time Picker Control,Version 6.0
没有的话自己百度找一个Excel Date Picker插件
<select name="select1" onChange="if(this.value==1){document.all.text1.value=new Date}else{document.all.text1.value=''}"><option value="">请选择</option>
<option value="1">是</option>
<option value="0">否</option>
</select>
<input name="text1">
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)