网站的条款和条件弹出窗口
<script type="text/javascript">
<!--
function myPopup(){
window.open("http://supportplans.co.uk/wp-content/themes/MyProduct/TandC.html",
"myWindow", "status = 1, height = 300, width = 300, resizable = 0" )
return false;
}
//-->
</script>
<form method="post" target="_blank">
我的网站上有一个 PayPal 按钮,单击后会打开一个包含条款和条件的小窗口:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick" />
<input type="hidden" name="cmd" value="_s-xclick" />
<input type="hidden" name="hosted_button_id" value="RULSZYMU6S3KN" />
<input type="hidden" name="hosted_button_id" value="4MUG5X5JBXNCA" /
<input type="Submit" name="submit" value="I accept" />
单击“我接受”时,会在小窗口中打开 PayPal 的付款页面。
如何在新窗口中打开 PayPal?我还希望在 onClick 方法中关闭小的“条款和条件”窗口。
<script type="text/javascript">
<!--
function myPopup(){
window.open("http://supportplans.co.uk/wp-content/themes/MyProduct/TandC.html",
"myWindow", "status = 1, height = 300, width = 300, resizable = 0" )
return false;
}
//-->
</script>
<form method="post" target="_blank">
I have a PayPal button on my site and when clicked it opens a small window with the terms and conditions:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick" />
<input type="hidden" name="cmd" value="_s-xclick" />
<input type="hidden" name="hosted_button_id" value="RULSZYMU6S3KN" />
<input type="hidden" name="hosted_button_id" value="4MUG5X5JBXNCA" /
<input type="Submit" name="submit" value="I accept" />
When clicking I Accept, it opens the payment page on PayPal in the tiny window.
How do I get it to open the PayPal in a new window? I would also like the small Terms and Conditions window to close in the onClick method.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
只需在条款和条件页面的
window.close()
应该在条款和条件页面中工作,因为它也是通过 javascript 打开的。Just use
target="_blank"
in the<form>
in the terms and conditions page, and add anonclick
event handler on the<submit>
button that doeswindow.close()
.window.close()
should work in the terms and conditions page, because it was also opened through javascript.由于表单将在您单击“接受”按钮后提交,因此您可以在服务器端代码中将 URL 重定向到支付页面。
因此条款和条件小窗口不会关闭,而是重定向到付款页面(仍在小窗口中)。
根据您的评论,您可以尝试将以下内容添加到服务器端代码的末尾:
它将关闭小窗口并打开支付页面的新窗口。
Since the form will be submitted after you click the Accept button, you can redirect the URL to the payment page in your server-side code.
So the small Terms and Conditions window will not closed, but redirect to the payment page (still in the small window).
According to your comment, you can try to add below to the end of your server side code:
It will close the small window and open a new window for the payment page.