function checkpasswd(){
var passwd = document.getElementByIdx_x_x_xx_x('passwd').value;
var repasswd = document.getElementByIdx_x_x_xx_x('repasswd').value;
if(passwd == repasswd){
return true;
}else{
window.alert('两次输入密码不一致');
return false;
}
}
触发:<input type='submit' name='button' id='submit' onclick='return checkpasswd()' value='确认添加' />