<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script  language="javascript">function myCheck(){ if(form1.name.value==""||form1.name.value==null){
alert("用户名不能为空!!");
form1.name.focus();
}else 
alert("form1.submit()");
}</script>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head><body>
<form name="form1" action="add.jsp" method="post">
<table >
<tr>
<td>name:</td>
<td><input type="text" name="name"  ></td>
</tr>
<tr>
<td colspan="2" align="center" >
<input type="button" value="add" onClick="myCheck()">
</td>
</tr>
</table>
</form>
</body>
</html>