请帮忙整合这2个表单验证文件???
exten 2004-01-07 08:20:06 一个是JAVASCRIPT文件,另外一个是VBSCRIPT文件,请问能否帮忙整合成一个JAVASCRIPT文件???(要求提交时才验证)
--Validate.asp
<script language=javascript>
function txt_cust_name()
{
if(myForm.cust_name.value.length == 0)
{
alert ("客户不能为空");
myForm.cust_name.focus();
return false;
}
return true;
}
function txt_connectman()
{
if(myForm.cust_connectman.value.length == 0)
{
alert ("联络人不能为空");
myForm.cust_connectman.focus();
return false;
}
return true;
}
function txt_telephone()
{
if(myForm.cust_telephone.value.length == 0)
{
alert ("电话号码不能为空");
myForm.cust_telephone.focus();
return false;
}
return true;
}
function checkInput()
{
var txt_cust_namegood=txt_cust_name();
if (!txt_cust_namegood)
return txt_cust_namegood;
var txt_connectmangood=txt_connectman();
if (!txt_connectmangood)
return txt_connectmangood;
var txt_telephonegood=txt_telephone();
if (!txt_telephonegood)
return txt_telephonegood;
}
</script>
<script language= "VBScript" >
''1、退修总数(name="sum_prepare")只能输入数字。
''2、预定修护日期(name="date_prepare")只能输入日期,且格式为2004-01-08,并且输入的日期至少为“当前日期+7天”
''检验日期是否符合要求
Function checkDate(text)
Dim inDate, nowDate, DifDate
DifDate = 7
inDate = Replace(Trim(text.value), ". ", "- ")
If not IsDate(inDate) Then
alert( "请输入日期, 格式为 xxxx-xx-xx 或 xxxx.xx.xx! ")
text.select()
exit function
End If
''取服务器时间验证
nowDate = CDate( " <%=Date()% > ")
text.value = inDate
If Not(inDate > nowDate and (DateDiff( "d ", nowDate, inDate) >DifDate)) Then
alert( "您输入的日期应该大于当前日期 " & nowDate & "至少 " & DifDate & "天! ")
text.select()
Exit Function
End If
End Function
''只能输入数字
Sub NumCheck()
keyValue=window.event.keyCode
IF keyValue <45 OR keyValue >57 Then
window.event.returnValue=false
End IF
End Sub
''检验是否数字
Sub CheckNum(text)
If not IsNumeric(text.value) Then
alert( "请输入数值! ")
text.select()
End If
End Sub
</script >
--aaa.asp
<!--#include file="Validate.asp" -->
<form name="myForm" method="post" onSubmit="return checkInput()">
<p align="center">产品退修通知书</p>
<table align=center>
<tr>
<td width="15%" height="25" colspan="2" bgColor=#e8e8e8 class=a>
<span class="style1">*</span>客户:</td>
<td colspan="3">
<input type="text" name="cust_name">
</td>
<td class=a width="15%" bgColor=#e8e8e8>
产品名称:
</td>
<td colspan="2">
<input type="text" name="product_name">
</td>
</tr>
<tr>
<td colspan="2" class=a width="15%" bgColor=#e8e8e8>
地址:
</td>
<td colspan="3">
<input type="text" name="cust_address">
</font></td>
<td class=a width="15%" bgColor=#e8e8e8>
退修总数:
</td>
<td colspan="2">
<input type="text" name="sum_prepare">
</font></td>
</tr>
<tr>
<td colspan="2" class=a width="15%" bgColor=#e8e8e8>
<span class="style1">*</span>联络人:
</td>
<td colspan="3">
<input type="text" name="cust_connectman">
</td>
<td class=a width="15%" bgColor=#e8e8e8>
预定修护日期:
</td>
<td colspan="2"> <input type="text" name="date_prepare"></td>
</tr>
<tr>
<td colspan="2" class=a width="15%" bgColor=#e8e8e8>
<span class="style1">*</span>电话号码:
</td>
<td colspan="3">
<input type="text" name="cust_telephone">
</td>
<td class=a width="15%" bgColor=#e8e8e8>
要求归还日期:
</td>
<td colspan="2">
<input type="text" name="date_return">
</td>
</tr>
</table></td>
</tr>
<tr>
<td><table width=100%>
<tr>
<td>
<div align="center">
<input type="submit" name="submit" value="提交">
<input type="reset" name="reset" value="清除">
</div>
</td>
</tr> </table>
</td>
</tr>
</td>
</tr>
</table>
</form>