jQuery目标不同的窗口/弹出窗口 [英] jQuery target different window/popup

查看:86
本文介绍了jQuery目标不同的窗口/弹出窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我让jQuery打开一个弹出窗口:

I have jQuery open a popup:

function idealPopUp(str){
    var url = str;
    var windowName = "idealPopUp";
    var windowSize = 'height=820,width=784,toolbar=no,scrollbars=yes';              
    window.open(url, windowName, windowSize);
    event.preventDefault();
}

我可以从原始窗口中将jQuery作为目标弹出窗口吗?我想知道什么时候关闭.弹出窗口的内容来自另一个站点,我无法控制它的jas/html等.

can I, from the original window, have jQuery target that popup? I want to know when it closes. The content of the popup is from another site and I have no control over it's jas/html etc.

我在原始窗口中有此文件,可以尝试与弹出窗口进行对话:

I have this in the original window to try and talk to the popup:

$(document).ready(function(){
    $('#idealPopUp').unload( function () {
        alert("BING");
    });
});

..

..

更新功能:

function idealPopUp(url){
    var windowName = "idealPopUpWindow";
    var windowSize = 'height=820,width=704,toolbar=no,scrollbars=yes';

    var idealPopUpWindow = window.open(url, windowName, windowSize);

    $(idealPopUpWindow).unload( function () {
        alert("BING");
    });
    event.preventDefault();
}

推荐答案

var otherWindow = window.open(url, windowName, windowSize);

是窗口引用;现在您可以

is a window reference; now you can

$(otherWindow).unload(...);

这篇关于jQuery目标不同的窗口/弹出窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆