关闭弹出窗口后如何重定向

时间:2019-04-26 08:32:49

标签: popup

基本上,我是在弹出窗口中提交PayPal表单。之后,我要执行的操作是,如果用户关闭弹出窗口,则父窗口应重定向到另一个页面。

我已经能够直接将paypal表单提交到弹出窗口中,因此我不能将任何js代码作为其基本的paypal本身添加到弹出窗口中。

<script type="text/javascript">
function submitForm(){
    var width  = 500;
    var height = 600;
    var left   = (screen.width  - width) / 2;
    var top    = ((screen.height - height) / 2) - 40;
    var params = 'width=' + width + ', height=' + height;
    params += ', top=' + top + ', left=' + left;
    params += ', directories=no';
    params += ', location=no';
    params += ', menubar=no';
    params += ', resizable=no';
    //params += ', scrollbars=no';
    params += ', status=no';
    params += ', toolbar=no';

    document.frmPayPal.target = "winPayPal";
    popup = window.open("","winPayPal",params);
    document.frmPayPal.submit();

    popup.onunload = function() {
        parent.alert("If you've completed the transaction then please click OK");
        window.top.location.href = "check-paypal-order.php?oid=<?=$a0["ordr_id"]?>";
    };      
}
</script>

0 个答案:

没有答案