我希望我的代码更准确。有人可以建议我编写以下更合适的代码片段吗?
<script>
var frmvalidator = new Validator("SubscriptionForm");
frmvalidator.EnableOnPageErrorDisplaySingleBox();
frmvalidator.EnableMsgsTogether();
frmvalidator.addValidation("usernameReg","req","Please enter your Username");
frmvalidator.addValidation("usernameReg","maxlen=20", "Max length for Username is 20");
frmvalidator.addValidation("usernameReg","alpha_s","Username can contain alphabetic chars only");
frmvalidator.addValidation("usernameReg","req","Please enter your Username");
frmvalidator.addValidation("usernameReg","maxlen=20", "Max length for Username is 20");
frmvalidator.addValidation("usernameReg","alpha_s","Username can contain alphabetic chars only");
frmvalidator.addValidation("fname","req","Please enter your First Name");
frmvalidator.addValidation("fname","maxlen=20", "Max length for FirstName is 20");
frmvalidator.addValidation("fname","alpha_s","Name can contain alphabetic chars only");
frmvalidator.addValidation("lname","req","Please enter your Last Name");
frmvalidator.addValidation("lname","maxlen=20","For LastName, Max length is 20");
frmvalidator.addValidation("email","maxlen=50");
frmvalidator.addValidation("email","req");
frmvalidator.addValidation("email","email");
</script>