Javascript 如何使用两个结果一次进行两次验证

Javascript 如何使用两个结果一次进行两次验证,javascript,html,jquery-ui,jquery,Javascript,Html,Jquery Ui,Jquery,我创建了一个带有两个复选框的验证 这两种验证都可以很好地使用javascript 让我给你看看我的代码 javascipt function Validation_agree(){ if(document.form1.agreed1.checked==false) { $(".agreement_main").show(); return false }else{ $(".agreement_main").hide();

我创建了一个带有两个复选框的验证

这两种验证都可以很好地使用javascript

让我给你看看我的代码

javascipt

function Validation_agree(){
    if(document.form1.agreed1.checked==false)
    {
        $(".agreement_main").show();
        return false
    }else{
        $(".agreement_main").hide();
    }

    if(document.form1.agreed2.checked==false)
    {
        $(".agreement_terms").show();
        return false
    }else{
        $(".agreement_terms").hide();
    }
}
形式就像

 <div class="checkme">
  <label><input type="checkbox" value="" name="agreed1" />I have discussed all of the order details above and the customer is happy to proceed</label>
<br />
  <div class="alert agreement_main" style="display:none;">Please confirm you have informed the customer of the T&amp;Cs</div>
</div>

 <div class="redNote">
 <label><input type="checkbox" value="" name="agreed2" />I have informed the customer where they can find the T&C’s on the BT.com website</label></p>
 <div class="alert agreement_terms" style="display:none;">Please confirm you have informed the customer of the T&amp;Cs</div>
 </div>


 <input type="submit" value="submit order" /></div>
</form>                    

我已经讨论了上述所有订单细节,客户很乐意继续

请确认您已通知客户T&;铯 我已通知客户,他们可以在BT.com网站上找到T&C

请确认您已通知客户T&;铯
问题是。一个在和另一个约会后工作
按下提交按钮时,显示第一条验证错误消息。我想一次进行两次验证检查

有人帮我吗
提前感谢

下面的代码可能适合您

function Validation_agree(){       
 var isValid = true;
 if(document.form1.agreed1.checked==false)       
  {           
      $(".agreement_main").show();           
         isValid = false;
   }else
    {           
      $(".agreement_main").hide();       
    }          
   if(document.form1.agreed2.checked==false)       
    {           
      $(".agreement_terms").show();           
       isValid = false;      
     }else{           
       $(".agreement_terms").hide();       
      }   
      return isValid;
}   

我的一个应用程序也面临着类似的问题:(@maanu)您可以使用JQone提供的答案,这很好