Function <!--#include file= "strcheck.asp"-->
<%
' In the process of writing a program, I need to use
' For I=1 to n
"Response.Write" <input type=text name=name "&n&" > "
' Next
But in JavaScript I don't know the name of the test, so I thought of using ASP to automatically generate JavaScript code to verify text
' By invoking the process, you can test it in a loop-controlled form.
'---------------------------------
' Create JavaScript by ASP
' Write by MIS in 2001,3,31
' MIS@tonghua.com.cn
' Http://www.meetweb.net
'---------------------------------
' The beginning of JavaScript Checkhead
Call Checkhead
' Check if the field is empty the first argument is the name of the box to check, and the second parameter is the prompt error message
Nullcheck "Name1", "It is null string"
Nullcheck "Tel", "It is null string"
' Check if the field for the phone is the first parameter is the name of the box to check, and the second parameter is the prompt error message
Checktel "Tel", "It must be a tel!"
' Check is the length of the field check the first parameter is the name of the box you want to check, and the second parameter is the prompt error message
' The third parameter is the minimum length, and the fourth parameter is the maximum length
Lengthcheck "Changdu", "It is max=8 and min=2", "2", "8"
' Check is email field check the first parameter is the name of the box you want to check, and the second parameter is the prompt error message
Emailcheck "Email", "it must be a email!"
' Check is the date of the field check the first parameter is the name of the box to check, and the second parameter is the prompt error message
Datecheck "Datestr", "It is date"
Nullcheck "Numstr", "It is null string"
' Check if the field is a number the first parameter is the name of the box to check, and the second parameter is the prompt error message
Numericcheck "Numstr", "It must be num!"
' The end of JavaScript Checktail
Call Checktail
%>
<body>
<form name=form1 method=post action= "index.asp" onsubmit= "return send" >
Is null: <input type=text name=name1 ><br>
Telephone Inspection: <input type=text Name=tel ><br>
Length inspection: <input type=text name=changdu > (2--8) <br>
Email check: <input type=text name=email><br>
Date check: <input type=text name=datestr> (2000-10-1) <br>
Digital check: <input type=text name=numstr><br>
<input class=input type= ' submit ' name= ' submit ' value= ' OK ' >
</body>