网站的条款和条件弹出窗口

发布于 2024-12-10 16:55:36 字数 930 浏览 0 评论 0原文

<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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

娇妻 2024-12-17 16:55:36

只需在条款和条件页面的

中使用 target="_blank",并在 onclick 上添加一个 onclick 事件处理程序即可。 code>按钮执行 window.close()

<form action="https://www.paypal.com/cgi-bin/webscr" 
        method="post" 
        target="_blank">
    <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" onclick="window.close();" />
</form>

window.close() 应该在条款和条件页面中工作,因为它也是通过 javascript 打开的。

Just use target="_blank" in the <form> in the terms and conditions page, and add an onclick event handler on the <submit> button that does window.close().

<form action="https://www.paypal.com/cgi-bin/webscr" 
        method="post" 
        target="_blank">
    <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" onclick="window.close();" />
</form>

window.close() should work in the terms and conditions page, because it was also opened through javascript.

得不到的就毁灭 2024-12-17 16:55:36

由于表单将在您单击“接受”按钮后提交,因此您可以在服务器端代码中将 URL 重定向到支付页面。

因此条款和条件小窗口不会关闭,而是重定向到付款页面(仍在小窗口中)。

根据您的评论,您可以尝试将以下内容添加到服务器端代码的末尾:

response.write("<script type='text/javascript'>");
response.write("window.close();");
response.write("window.opener.open(.....payment url....)");
response.write("</script>");

它将关闭小窗口并打开支付页面的新窗口。

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:

response.write("<script type='text/javascript'>");
response.write("window.close();");
response.write("window.opener.open(.....payment url....)");
response.write("</script>");

It will close the small window and open a new window for the payment page.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文