条款和条件弹出网站

Terms and Conditions popup for website

本文关键字:网站 条件      更新时间:2023-09-26
<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方法中关闭小条款和条件窗口。

在条款和条件页面的<form>中使用target="_blank",并在执行window.close()<submit>按钮上添加onclick事件处理程序。

<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打开的。

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

所以小的条款和条件窗口不会关闭,而是重定向到支付页面(仍然在小窗口中)。

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

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

将关闭小窗口,并打开付款页面的新窗口。