从iframe更改为弹出窗口

时间:2013-09-22 15:03:02

标签: jquery iframe

点击这些链接的任何(.sce_edit_link_a,.sce_edit_link_short,.sce_image_link,.sce_file_link),它将使用

在Iframe中显示其内容
link = $(this).attr('href');
        $('#sce_frame').attr('src', link);

无论如何在弹出窗口而不是iframe中显示它们?

<!--V.0.7-->
<div class="sce_hidden">
    <div id="edit_mode">
        <iframe src="#" style="width:100%; height:100%;" frameborder="0" name="sce_frame" id="sce_frame" scrolling="no"></iframe>
    </div>
</div>

<script type="text/javascript">
$(document).ready(function(){
    $('.sce_edit_link_a, .sce_edit_link_short, .sce_image_link, .sce_file_link').click(function(){
        link = $(this).attr('href');
        $('#sce_frame').attr('src', link);

        $( '#edit_mode' ).dialog({
            width: 500,
            height: 500,
            resizable: true,
            buttons: [{
                text: '<?php echo(lang_front_close); ?>',
                click: function(){ $(this).dialog('close'); window.location.reload();}
            }]
        });

        return false;
    });

    $('#sce_controlcenter').click(function(){
        link = $(this).attr('href');
        $('#sce_frame').attr('src', link);

        $( '#edit_mode' ).dialog({
            width: 500,
            height: 500,
            resizable: true,
            buttons: [{
                text: '<?php echo(lang_front_close); ?>',
                click: function(){ $(this).dialog('close'); window.location.reload();}
            }]
        });

        return false;
    });

    $('#sce_reloadpage').click(function(){
        window.location.reload();
        return false;
    });
});

<?php
if($_GET['reload']=='yes'){
    echo('window.location.href = \'//'. $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'].'\';');
}
?>
</script>

1 个答案:

答案 0 :(得分:0)

使用window.open而不是设置iframe src

link = $(this).attr('href');
window.open(link,"windowName","resizable,scrollbars,status");

window.open MDN doc