无需单击按钮即可自动为网页上的表单运行
Automatically function for a form on webpage without click on button
这是我在单击“立即购买”按钮后转到该项目的 Paypal 支付网关的代码,但我希望此功能甚至无需单击“立即购买”按钮,我的意思是当网页打开时自动转到 Paypal 支付网关,而无需单击“立即购买”按钮。可能吗?任何指导都会很有帮助。
<script type="text/javascript" src="https://test.com/java.js"></script>
<form target="PayPal" action="https://www.paypal.com/cgi-bin/webscr" method="post" style="margin:0;padding:0;">
<input type="hidden" name="business" value="test@yahoo.com">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="item_name" value="Membership">
<input type="hidden" name="item_number" value="1 Month">
<input type="hidden" name="amount" value="23">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="shipping" value="">
<input type="hidden" name="shipping2" value="">
<input type="hidden" name="handling" value="">
<input type="hidden" name="return" value="https://test.com/Successful_Payment.php">
<input type="hidden" name="cancel_return" value="">
<input type="hidden" name="undefined_quantity" value="0">
<input type="hidden" name="receiver_email" value="test@yahoo.com">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="no_note" value="0">
<div id="PayPal6" style="position:absolute;left:445px;top:470px;width:134px;height:65px;">
<input type="image" name="submit" src="images/buynow.png" style="position:absolute;left:0px;top:0px;" alt="Make payments with PayPal, it's fast, free, and secure!">
</div>
</form>
你可以通过 JavaScript:
window.onload = function(){
// u should put a name for your form
document.forms['my_form_name'].submit();
}
编辑: 您也可以提交 PayPal 提交按钮而不是表单:
window.onload = function(){
document.getElementById('paypalButton').submit();
}
这是我在单击“立即购买”按钮后转到该项目的 Paypal 支付网关的代码,但我希望此功能甚至无需单击“立即购买”按钮,我的意思是当网页打开时自动转到 Paypal 支付网关,而无需单击“立即购买”按钮。可能吗?任何指导都会很有帮助。
<script type="text/javascript" src="https://test.com/java.js"></script>
<form target="PayPal" action="https://www.paypal.com/cgi-bin/webscr" method="post" style="margin:0;padding:0;">
<input type="hidden" name="business" value="test@yahoo.com">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="item_name" value="Membership">
<input type="hidden" name="item_number" value="1 Month">
<input type="hidden" name="amount" value="23">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="shipping" value="">
<input type="hidden" name="shipping2" value="">
<input type="hidden" name="handling" value="">
<input type="hidden" name="return" value="https://test.com/Successful_Payment.php">
<input type="hidden" name="cancel_return" value="">
<input type="hidden" name="undefined_quantity" value="0">
<input type="hidden" name="receiver_email" value="test@yahoo.com">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="no_note" value="0">
<div id="PayPal6" style="position:absolute;left:445px;top:470px;width:134px;height:65px;">
<input type="image" name="submit" src="images/buynow.png" style="position:absolute;left:0px;top:0px;" alt="Make payments with PayPal, it's fast, free, and secure!">
</div>
</form>
你可以通过 JavaScript:
window.onload = function(){
// u should put a name for your form
document.forms['my_form_name'].submit();
}
编辑: 您也可以提交 PayPal 提交按钮而不是表单:
window.onload = function(){
document.getElementById('paypalButton').submit();
}