onclick功能无法正常工作

时间:2015-09-28 17:23:47

标签: javascript

这是我的代码,当我点击它时它应该运行它(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>

1 个答案:

答案 0 :(得分:1)

您的情况有误 把它改成这个

(jQuery("input[name='EWAY_PAYMENTTYPE']:checked").val() != 'payment_option_visacard' || jQuery("input[name='EWAY_PAYMENTTYPE']:checked").val() != 'payment_option_mastercard')