标签:.com onclick time div add 判断 pointer ddd str
1.引用my97 js 和css
2.前台代码
<div class="FormItem">
<label>
申请时间</label>
<div class="FormItemElement">
<input type="text" id="txt_ApplyDate" style="width: 200px; cursor: pointer;" readonly="readonly" class="txt Wdate" value="<%=_date %>"
onclick="setTime();" required="true" />
</div>
</div>
3.js 代码
<script language="javascript" type="text/javascript">
//设置时间
function setTime() {
WdatePicker({ minDate: ‘<%=_minDate %>‘, maxDate: ‘<%=_maxDate %>‘ })
}
</script>
4.后台代码
public string _minDate = "";
public string _maxDate = "";
protected void Page_Load(object sender, EventArgs e)
{
if (DateTime.Now.DayOfWeek == System.DayOfWeek.Monday) // 判断是否周一
{
_maxDate = DateTime.Now.ToString("yyyy-MM-dd");
_minDate = DateTime.Now.AddDays(-3).ToString("yyyy-MM-dd");
}
else if (DateTime.Now.DayOfWeek == System.DayOfWeek.Saturday) // 判断是否周六
{
_maxDate = DateTime.Now.ToString("yyyy-MM-dd");
_minDate = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd");
}
else if (DateTime.Now.DayOfWeek == System.DayOfWeek.Sunday) //判断是否周日
{
_maxDate = DateTime.Now.ToString("yyyy-MM-dd");
_minDate = DateTime.Now.AddDays(-2).ToString("yyyy-MM-dd");
}
else
{
_maxDate = DateTime.Now.ToString("yyyy-MM-dd");
_minDate = DateTime.Now.AddDays(-2).ToString("yyyy-MM-dd");
}
}
标签:.com onclick time div add 判断 pointer ddd str
原文地址:http://www.cnblogs.com/zhangjinjin/p/6125384.html