我试图在允许用户点击paypal按钮之前获得一个简单的条款和条件复选框。我目前有这个代码:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<!-- Identify your business so that you can collect the payments. -->
<input type="hidden" name="business" value="my email">
<!-- Specify a Buy Now button. -->
<input type="hidden" name="cmd" value="_xclick">
<!-- Specify details about the item that buyers will purchase. -->
<input type="hidden" name="item_name" value="15-minutes">
<input type="hidden" name="amount" value="15.00">
<input type="hidden" name="currency_code" value="USD">
<!-- Display the payment button. -->
<input type="image" name="submit" border="0" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynow_LG.gif"alt="stuff">
<img alt="" border="0" width="1" height="1" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" >
</form>
任何帮助或指导都会非常有用。
我们其他人的节日,
汤姆
答案 0 :(得分:1)
像这样的小jQuery应该可以解决这个问题:http://jsfiddle.net/mVK4r/
我添加了一个条款和条件复选框,然后进行测试以查看是否已选中。如果是,则按钮表现正常。如果不是,则会出现提示用户接受条款的警告,该按钮将无效。
希望这会有所帮助 - 祝你好运!
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<!-- Terms and Conditions check box -->
<p><input type="checkbox" id="terms"> Yes, I accept the terms and conditions</p>
<p> </p>
<!-- Identify your business so that you can collect the payments. -->
<input type="hidden" name="business" value="my email">
<!-- Specify a Buy Now button. -->
<input type="hidden" name="cmd" value="_xclick">
<!-- Specify details about the item that buyers will purchase. -->
<input type="hidden" name="item_name" value="15-minutes">
<input type="hidden" name="amount" value="15.00">
<input type="hidden" name="currency_code" value="USD">
<!-- Display the payment button. -->
<input type="image" id="button" name="submit" border="0" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynow_LG.gif" alt="stuff">
<img alt="" border="0" width="1" height="1" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" >
</form>
<script type="text/javascript">
$(function(){
$('#button').click(function(e){
if ($('#terms').prop('checked') == false) {
alert('Please accept the terms and conditions');
e.preventDefault();
}
else {
// Allow the button the do its thing
}
});
});
</script>