码迷,mamicode.com
首页 > Web开发 > 详细

解决IE6下JS动态插入iframe不显示的方法

时间:2015-01-09 17:06:00      阅读:160      评论:0      收藏:0      [点我收藏+]

标签:

function myshowBox(titles, urls, objWidth, objHeight, flags)
{
    var _title = titles;
    var _url = urls;
    var _width = objWidth;
    var _height = objHeight;
    var _flag = flags;
 
    $("body").append("<div class=‘myshowbox‘><div class=‘myshowbox-container‘><a class=‘btn-close‘ href=‘javascript:;‘></a><h3>" + _title + "</h3><iframe class=‘iframe-myshowbox‘ id=‘myshowbox‘ src=‘" + _url + "‘ frameborder=‘0‘ scrolling=‘no‘ width=‘" + _width + "‘ height=‘" + _height + "‘></iframe></div></div><div id=‘bgScreen‘></div><iframe id=‘bgIFrame‘ src=‘about:blank‘></iframe>");
    //判断是否有标题
    if (_title == "")
    {
        $(".myshowbox h3").hide();
    }
    else
    {
        $(".myshowbox h3").css("width", _width - 20 + "px");
    }
    $(".myshowbox-container").css("width", _width);
    $(".myshowbox").css("margin", -$(".myshowbox").height() / 2 - 5 + "px 0 0 " + -$(".myshowbox").width() / 2 + "px");
    $("#bgScreen, #bgIFrame").css("height", $("body").height() + "px");
 
    //关闭释放
    $(".myshowbox-container .btn-close, #bgScreen").live(‘click‘, function()
    {
        $(".myshowbox, #bgScreen, #bgIFrame").hide().remove();
    })
 
    //IE6 BUG fix
    var ieset = navigator.userAgent;
    if (ieset.indexOf("MSIE 6.0") > -1)
    {
        setTimeout(‘window.parent[\‘myshowbox\‘].location.reload();‘, 0);
    }
}
 

解决IE6下JS动态插入iframe不显示的方法

标签:

原文地址:http://www.cnblogs.com/mixzo/p/4213619.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!