对文本框进行比较就可以
<html>
<head>
<script language="javascript">
function Submit()
{
if(document.form1.pwd.value="")
{
alert('密码不能为空');
return false;
}
if(document.form1.pwd.value!=document.form1.repwd.value)
{
alert('两次输入的密码不一致');
return false;
}
}
</script>
</head>
<body>
<from name="form1">
<input type="password" name="pwd"><br>
<input type="password" name="repwd"><br>
<input type="button" name="Submit" onClick="Submit();" value="提交">
</form>
</body>
</html>