[摘要]" + "\n" +"fucCheckLength(document."+formName+"."+inputName+&quo... " + "\n" + "fucCheckLength(document."+formName+"."+inputName+".value)>"+MaxLength+") {" + "\n" + "alert(\""+errorMsg+".\");" + "\n" + "document."+formName+"."+inputName+".focus();" + "\n" + "return(false);" + "\n" + "}" + "\n\n"; }
/***************************************************************************\ *public: check the email *检查录入框值是否是正确的EMAIL格式 \***************************************************************************/ public void emailCheck(String inputName, String errorMsg){ this.errorCheckStr += "if(chkemail(document."+formName+"."+inputName+".value) == 0) {" + "\n" + "alert(\""+errorMsg+".\");" + "\n" + "document."+formName+"."+inputName+".focus();" + "\n" + "return(false);" + "\n" + "}" + "\n\n"; }
/***************************************************************************\ *public: check the telephone number *检查录入框值是否是电话号码 \***************************************************************************/ public void telCheck(String inputName, String errorMsg){ this.errorCheckStr += "if(fucCheckTEL(document."+formName+"."+inputName+".value) == 0) {" + "\n" + "alert(\""+errorMsg+".\");" + "\n" + "document."+formName+"."+inputName+".focus();" + "\n" + "return(false);" + "\n" + "}" + "\n\n"; }
/***************************************************************************\ *public: check if the input value contian the divfered string *检查录入框值是否是包含给定字串 \***************************************************************************/ public void stringCheck(String inputName, String errorMsg, String string){ this.errorCheckStr += "if(document."+formName+"."+inputName+".value.indexOf(\""+string+"\") != 0) {" + "\n" + "alert(\""+errorMsg+".\");" + "\n" + "document."+formName+"."+inputName+".focus();" + "\n" + "return(false);" + "\n" + "}" + "\n\n"; }
/***************************************************************************\ *public: check if the input value contain the denyed string *检查录入框值是否是包含给禁止的字串 \***************************************************************************/ public void denyStrCheck(String inputName, String errorMsg, String string){ this.errorCheckStr += "if (document."+formName+"."+inputName+".value.length == 0 |
关键词: 用 JSP 在客户端生成 JavaScript 代码来完成表单校验