<!-- // 非空验证 function requiredField(myId,errorMessage) ... { if(document.getElementById(myId).value == "") ...{ window.alert(errorMessage); document.getElementById(myId).focus(); return false; } return true;} // dropDownList myName值不能为myValue function dropCant(myId,myValue,errorMessage) ... { if(document.getElementById(myId).value == myValue) ...{ window.alert(errorMessage); document.getElementById(myId).focus(); return false; } return true;} // Email格式验证 function validEmail(myId,errorMessage) ... { var email = /^[_a-zA-Z0-9+.]+@([_a-zA-Z0-9]+.)+[a-zA-Z0-9]...{2,3}$/; if(email.test(document.getElementById(myId).value)) ...{ return true; } else ...{ window.alert(errorMessage); document.getElementById(myId).focus(); return false; }} // 两值是否相同(常用于密码比较) function compareValid(myId1,myId2,errorMessage) ... { if(document.getElementById(myId1).value == document.getElementById(myId2).value) ...{ return true; } else ...{ window.alert(errorMessage); document.getElementById(myId1).focus(); return false; }} // 字段长度验证(x位至y位) function validLength(myId,x,y,errorMessage) ... { if(document.getElementById(myId).value.length < x || document.getElementById(myId).value.length > y) ...{ window.alert(errorMessage); document.getElementById(myId).focus(); return false; } return true;} --> Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=1146059