![]() |
#2
gupiao1752010-05-19 17:02
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>无标题文档</title> <script language="JavaScript" type="text/javascript" src="../js/function.js"></script> <script language="javascript"> function check() { if (document.myform.student_name.value == "") {window.alert('请输入姓名!!'); document.myform.student_name.focus(); return false;} else if (document.myform.sex.value == "") {window.alert('请输入性别!!'); document.myform.sex.focus(); return false;} else if (document.myform.age.value == "") { window.alert('请输入年龄!!'); document.myform.age.focus(); return false;} return true } </script> </head> <body> <table width="45%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td height="30" colspan="2"><div align="center"><strong>添加学生信息</strong></div></td> </tr> <form action="" method="post" name="myform" onsubmit="return check()" > <tr> <td width="16%" height="30"><div align="center">姓名:</div></td> <td width="84%" height="30"><input name="student_name" type="text" ></td> </tr> <tr> <td height="30"><div align="center" >性别:</div></td> <td height="30"><input name="sex" type="text" ></td> </tr> <tr> <td height="30"><div align="center" >年龄:</div></td> <td height="30"><input name="age" type="text" v></td> </tr> <tr> <td height="30"><div align="center">入校时间:</div></td> <td height="30"><input name="in_time" type="text" ></td> </tr> <tr> <td height="30"><div align="center">专业:</div></td> <td height="30"><input name="major" type="text" ></td> </tr> <tr> <td height="30"><div align="center">籍贯:</div></td> <td height="30"><input name="homeplace" type="text" ></td> </tr> <tr> <td height="30" colspan="2"><div align="center"> <input type="submit" name="Submit" value="提交" > <input type="reset" name="Submit2" value="重置"> </div> </td> </tr> </form> </table> </body> </html> 这样试试! |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<script language="JavaScript" type="text/javascript" src="../js/function.js"></script>
<script language="javascript">
function check()
if document.myform.student_id.value == "" then
window.alert('请输入名称!!');
document.myform.student_id.focus();
return false
else if
End if
if document.myform.student_name.value == "" then
window.alert('请输入名称!!');
document.myform.student_name.focus();
return false
else if
End if
if document.myform.sex.value == "" then
window.alert('请输入名称!!');
document.myform.sex.focus();
return false
else if
End if
return true
End function
</script>
</head>
<body>
<table width="45%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="30" colspan="2"><div align="center"><strong>添加学生信息</strong></div></td>
</tr>
<form action="save.asp" method="post" name="" >
<tr>
<td width="16%" height="30"><div align="center">姓名:</div></td>
<td width="84%" height="30"><input name="student_name" type="text" ></td>
</tr>
<tr>
<td height="30"><div align="center" >性别:</div></td>
<td height="30"><input name="sex" type="text" ></td>
</tr>
<tr>
<td height="30"><div align="center" >年龄:</div></td>
<td height="30"><input name="age" type="text" v></td>
</tr>
<tr>
<td height="30"><div align="center">入校时间:</div></td>
<td height="30"><input name="in_time" type="text" ></td>
</tr>
<tr>
<td height="30"><div align="center">专业:</div></td>
<td height="30"><input name="major" type="text" ></td>
</tr>
<tr>
<td height="30"><div align="center">籍贯:</div></td>
<td height="30"><input name="homeplace" type="text" ></td>
</tr>
<tr>
<td height="30" colspan="2"><div align="center">
<input type="submit" name="Submit" value="提交">
<input type="reset" name="Submit2" value="重置">
</div>
</td>
</tr>
</form>
</table>
</body>
</html>
谢谢大家,麻烦大家看看