一个简单问题,请高手指教,在线等
我在表单中输入一个日期,然后再在从数据库中调出我以前的日期,两个日期比较,如果输入的日期比数据库中的日期小,则弹出对话框,重新输入.
代码如下:
<%
Dim cc,id
Dim back_date
id=Request( "id ")
Set cc = Conn.Execute( "Select * From [takeshou] Where ID= "&id)
back_date=cc( "take_date ")
%>
<script language= "JavaScript ">
<!--
function chk(theForm){
if (theForm.take_date.value 请问这里怎么写)
alert( "请输入领料日期! ");
theForm.amount.focus();
return (false);
}
}
//-->
</script>
<form action= "wushou_Add2.asp " method=post id=form1 name=form1 onSubmit= "return chk(this) ">
<input name= "take_date " type= "text " id= "take_date ">
<input type= "submit " name= "Submit " value= "添 加 ">
<input name= "take_date " type= "text " id= "take_date ">
take_date为从文本框输入的日期
back_date为从数据库取出的日期
------解决方案--------------------function chk(theForm){
GetDay=new Date( " <%response.write format(back_date, "yyyy-MM-dd ")%> ");
if (theForm.take_date.value!=GetDay)
alert( "请输入领料日期! ");
theForm.amount.focus();
return (false);
}