开发者

jQuery: Accessing iframe dom from iframe itself

$.fn.resizer = function(o){

    var s = {}
    $.extend(s,o);

    return this.each(function(){

        $(this).css({
         开发者_JAVA百科   'width':s.width+20,
            'height':s.height+20
        })
            .parent().css({
                'width':s.width,
                'height':s.height
            });

    });

}

I want to do this with iframe, from inside iframe.

When i'm trying to call it from there via:

$(top).uploader_finish({
    width:original_width+<?php echo $this->sizes['width'] ?>+20,
    height:original_height+<?php echo $this->sizes['height'] ?>+80
}); 

Getting window of parent, but how to access iframe directly?

Thanks ;)

Update

The only solution i have found, is to calling like that:

$(top.document).find('iframe[name=default_1]');

And default_1 name sending like $_GET parameter inside src of iframe.

Or is there a way to get name of iframe, from inside?

Update

AHA! Found it :)

window.name

So basically it will look like this?

$(top.document).find('iframe[name='+window.name+']');


you can get the frame by it's ID

document.getElementById('frameId')

or in the window.frames collection

$(document).find("iframe").attr("name");
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜