这是,我刚写的,不过没来的及调试,尽供参考
<!--#include file="conn.asp"-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body>
<form name="form1" action="">
班级:<input type="text" name="class"><p>
学号:<input type="text" name="number"><p>
姓名:<input type="text" name="name"><p>
年龄:<input type="text" name="age" onFocus="check1()"><p>
<%
function check1()
response.Write("<sctipt language=javascript>document.form1.submit();</script>")
sql="select * from student where number="&request("number")
response.Write(request("number"))
set rs=conn.execute(sql)
if rs.eof then
response.Write("对不起,没有该学生,请重新输入!")
response.Write("<script language=javascript>history.go(0);return false;</script>")
else
if isempty(rs("age")) then response.Write("<sctipt language=javascript>alert('数据库中没有该学生的年龄!');document.form1.home.focus();〈/script>")
end if
end function
%>
籍贯:<input type="text" name="home" onFocus="check2()"><p>
<%
function check2()
if isempty(rs("home")) then response.Write("<sctipt language=javascript>alert('数据库中没有该学生的籍贯!');document.form1.home.focus();〈/script>")
end function
%>
电话:<input type="text" name="tel" onFocus="check3()"><p>
<%
function check3()
if isempty(rs("tel")) then response.Write("<sctipt language=javascript>alert('数据库中没有该学生的电话!');〈/script>")
end function
%>
<input type="submit" value="提交">
</form>
</body>
</html>
欢迎加入技术群5725994