关闭iframe,我的代码无效

时间:2014-01-28 12:17:48

标签: javascript

我需要从iframe本身关闭我的iframe,但我知道它无法完成,所以我怎么能这样做,因为我已经尝试了所有我知道的 这是我用来打开Iframe的代码

function displayPopup(params)
{
var pageid=1;
var pageObj = Runner.pages.PageManager.getById(pageid);
args = {
bodyContent: "<iframe frameborder='0' id='popupIframe" + pageid + "' name='popupIframe" + pageid + "' style='width: 100%; height: 100%; border: 0;'></iframe>",
footerContent: "<span>&nbsp;</span>",
headerContent: params.headerContent,
centered: true,
render: true,
width: params.width ? params.width : 800,
height: params.height ? params.height : 520
},
afterCreateHandler = function(win) {
var bodyNode = $(win.bodyNode.getDOMNode()),
iframeNode = $("iframe#popupIframe" + pageid, bodyNode);

iframeNode.load(function() {
if (Runner.isChrome) {
bodyNode.addClass("noScrollBar");
}
win.show();

}).attr("src", params.url);
},
afterCloseHandler = params.afterClose;

if (Runner.isChrome) {
$("< style type='text/css'> .yui3-widget-bd::-webkit-scrollbar {display:none;} < /style>").appendTo("head");
}

Runner.pages.PageManager.createFlyWin.call(pageObj, args, true,
afterCreateHandler, afterCloseHandler);
}



    function checkAval()
{
    params = {
    url: 'checkAvailableRooms.php',
    afterClose: function(win) {
    win.destroy(true);
    },
    headerContent: 'Check Avaliable Rooms'
};
    displayPopup(params);
}checkAval();

这是我在iframe中使用的代码,以便关闭它

$(document).ready(function(){
                        var pageid = 1;
            $("#close_nr").bind("click",{page:this}, function(e){
                $('#popupIframe'+pageid).remove();

            });

但是它无法正常工作请我帮助您使这段代码正常工作。提前谢谢

0 个答案:

没有答案