这是我的代码,当我点击它时它应该运行它(ChoosePaymentOption();)但它不起作用。
<input width="300px" type="image" height="150px" style="margin:auto;" onclick="ChoosePaymentOption();" src="images/proceed_to_payment_button.jpg" value="Pay" name="btnSubmit" id="btnSubmit"></p>
<script>
function ChoosePaymentOption() {
if(document.getElementById('payment_option_mastercard').checked == false && document.getElementById('payment_option_visacard').checked == false && document.getElementById('payment_option_masterpass').checked == false && document.getElementById('payment_option_vme').checked == false)
{
alert("Please select Payment Option");
return false;
}
if (jQuery("input[name='EWAY_PAYMENTTYPE']:checked").val() != 'payment_option_visacard' || "input[name='EWAY_PAYMENTTYPE']:checked").val() != 'payment_option_mastercard') {
jQuery('#form1').submit();
}
}
</script>
答案 0 :(得分:1)
您的情况有误 把它改成这个
(jQuery("input[name='EWAY_PAYMENTTYPE']:checked").val() != 'payment_option_visacard' || jQuery("input[name='EWAY_PAYMENTTYPE']:checked").val() != 'payment_option_mastercard')