Paypal按钮带有£0选项

时间:2017-05-19 07:30:22

标签: html paypal

我有一个PayPal表单,有三个选项£5,£3& £0。

如果我选择5英镑或3英镑但按钮不起作用,则该按钮有效。有没有办法捕获何时点击“付费”按钮并选择£0选项将用户重定向到预先确定的URL,如“bbc.co.uk”?

对此有任何帮助将不胜感激。

以下是表格:

<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="CUP9TLQ96MR28">
<table>
    <tr>
        <td><input type="hidden" name="on0" value="str8RED"></td>
    </tr>
    <tr>
        <td>
            <select name="os0">
            <option value="Premium ->">Premium -> £5.00 GBP</option>
            <option value="Standard ->">Standard -> £3.00 GBP</option>
            <option value="Basic ----->">Basic -----> £0.00 GBP</option>
            </select>
            <input type="hidden" name="currency_code" value="GBP">
            <input type="image" src="https://www.paypalobjects.com/en_GB/i/btn/btn_paynow_SM.gif" border="0" name="submit" alt="PayPal – The safer, easier way to pay online!">
            <img alt="" border="0" src="https://www.paypalobjects.com/en_GB/i/scr/pixel.gif" width="1" height="1">
        </td>
    </tr>
</table>

1 个答案:

答案 0 :(得分:2)

这应该有效。 (JSFiddle

<script>
function myFunction() {
  var sel= document.getElementById("os0");
  if (sel.options[sel.selectedIndex].value == 'Basic ----->') {
    window.location.replace("http://stackoverflow.com");
    return false;
  } else {
    document.getElementById("myForm").submit();
  }
</script>



<form id="myForm" onsubmit="event.preventDefault(); myFunction();">
  ...
  <select name="os0" id="os0">
    ...
  </select>
  ...
</form>