小弟现在有一TextBox,输入时间,如:2004-11-28,
但是现在我想对这个时间进行验证,这个输入的时间必须大于当今时间,
我用的是CompareValidator,我选择""GreaterThan",但是现在的问题是,我在.aspx下要得到当今时间,怎么得到,并且怎么写到CompareValidator属性ValueToCompare,我开始是这么写的
我写了javascript:function Date theDate()
{
today=new Date();
//ymd=(today.getYear()+"-"+today.getMonth()+"-"+today.getDay());
//hms=(" "+today.getHours()+":"+today.getMinutes()+":"+today.getSeconds());
//document.all.d.innerText=ymd+hms;setTimeout("theDate()",1000);
return today.getDate()
}然后:验证控件写的如下:::
<asp:CompareValidator id="CompareValidator1" runat="server" ErrorMessage="截止日期必须大于当今时间" ControlToValidate="cl_HWLastTime"
Operator="GreaterThan" Type="Date" ValueToCompare="the Date();"></asp:CompareValidator>
但是这样不行,哪里写错了????
但是现在我想对这个时间进行验证,这个输入的时间必须大于当今时间,
我用的是CompareValidator,我选择""GreaterThan",但是现在的问题是,我在.aspx下要得到当今时间,怎么得到,并且怎么写到CompareValidator属性ValueToCompare,我开始是这么写的
我写了javascript:function Date theDate()
{
today=new Date();
//ymd=(today.getYear()+"-"+today.getMonth()+"-"+today.getDay());
//hms=(" "+today.getHours()+":"+today.getMinutes()+":"+today.getSeconds());
//document.all.d.innerText=ymd+hms;setTimeout("theDate()",1000);
return today.getDate()
}然后:验证控件写的如下:::
<asp:CompareValidator id="CompareValidator1" runat="server" ErrorMessage="截止日期必须大于当今时间" ControlToValidate="cl_HWLastTime"
Operator="GreaterThan" Type="Date" ValueToCompare="the Date();"></asp:CompareValidator>
但是这样不行,哪里写错了????
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货