<script language="JavaScript">
function toSubmit(){
if(form1.username.value==""){
alert("用户名不能为空!");
return false;}
if(form1.password.value==""||form1.repassword.value==""){
alert("密码框不能为空!");
return false;
}
if(form1.password.value!=form1.repassword.value){
alert("两次输入的密码不一致,请确认后重新输入");
return false;
}
else{return true;}
}
<form name="form1" action="tjuser.asp" method="post" target="hideFrame">
<table width="600" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td height="25" colspan="2" valign="middle" class="title">添加下载用户</td>
</tr>
<tr>
<td width="80" height="25" valign="middle">用户名</td>
<td width="520" valign="middle"><input name="username" type="text" id="username" size="20"></td>
</tr>
<tr>
<td width="80" height="25" valign="middle">新密码</td>
<td width="520" valign="middle"><input name="password" type="password" id="password" size="20"></td>
</tr>
<tr>
<td height="25" valign="middle">确认新密码</td>
<td valign="middle"><input name="repassword" type="password" id="repassword" size="20"></td>
</tr>
<tr>
<td height="40"> </td>
<td valign="middle"><input type="submit" name="Submit" value="添加用户" class="button" οnclick="return toSubmit();">
</td>
</tr>
</table>
</form>