2011-08-26 36 views

回答

1

嗯......没有一些代码和更具体的细节上,你需要什么,我只能给你一些提示。您可以使用类似下面的代码来验证您的客户端上的表单:

<form id="someForm" action="someURL"> 
    <input id="input1" type="text" value=""/> 
    <input id="input2" type="text" value=""/> 
    ... 
    <input id="inputn" type="text" value=""/> 
</form> 

<script type="text/javascript"> 
    $("#someForm").submit(function(){ 
     var valid = true; 
     if ($("#input1").val() == "") { 
      alert("Please enter information for input1"); 
      valid = false; // prevent the form from being submitted 
     } // use else, if put more conditions here 
     return valid; 
    }); 
</script> 

希望它有帮助!