小弟在iframe中调用document.write,但ie9下执行会什么都没有。小弟用的是jquery框架,麻烦各位高手指教。
    尝试过用developer toolbar跟进去,发现ie9下执行第一句document.write的时候就会跳走,然后什么都没有。该页面在FF,Chrome,Safari,以及IE7,8甚至IE6下都可以正常运行。但在IE9下却不会向下执行,请问各位大侠是什么问题引起??是IE的加载模式还是什么问题??
    照理说IE6,7,8都顺利运行的情况下IE9亦会顺利运行。以下是该函数代码,请各位高手帮忙解决解决,该问题已困扰我很久了。function showMessage(msg, reload) {
    document.domain = "ijie.com";
    var mysharecontrol = $(parent.document.getElementById('MyShareControl')).attr('height') || "";
    var floatBox = $(parent.document.getElementById("floatBox")).find("iframe").css('height') || $(parent.document.getElementById("floatBox")).find("iframe").attr('height') || "";
    var oriHeight = mysharecontrol || floatBox;
    oriHeight = oriHeight.replace(/px/ig, '') || document.body.scrollHeight;
    var height = 210;
    $(parent.document.getElementById('MyShareControl')).attr('height', height).css('height', height);
    $(parent.document.getElementById("floatBox")).find("iframe").css('height', height);
    document.open();
    document.write('<link href="http://content1.ijie.cn/zh-CN/20110823/style/snsconnector/askform.css" type="text/css" rel="stylesheet"/>');
    document.write('<script src="http://content1.ijie.cn/zh-CN/script/common/jquery/1.6/jquery.min.js" type="text/javascript"></script>');
    if (reload) {
        document.write('<script type="text/javascript">function CloseWidget(){$(parent.document.getElementById("MyShareControl")).attr("height", ' + oriHeight + ').css("height",' + oriHeight + ');$(parent.document.getElementById("floatBox")).find("iframe").css("height",' + oriHeight + ');if (parent.DialogManager){document.location.href=$(parent.document.getElementById("MyShareControl")).attr("src");}else if($("#floatBoxBg").css("display") != "none"){document.location.href=$(parent.document.getElementById("floatBox")).find("iframe").attr("src");}};</script>');
    }
    else {
        document.write('<script type="text/javascript">function CloseWidget(){document.domain = "ijie.com";if (parent.DialogManager){parent.DialogManager.close("my_partner_add");}else if($("#floatBoxBg").css("display") != "none"){parent.Dialog_Close();}};</script>');
    }
    document.write('<script type="text/javascript">document.domain = "ijie.com";</script>');
    document.write('<div class="askform"><div class="asksharerow" align="center" style="margin: ' + (height - 160) / 2 + 'px 22px; height: 100px; width: 300px;"><div class="asksharerow-t" style="margin: 15px auto 0; float: none; text-aligh:center;">' + msg + '</div>5秒钟后自动<a href="javascript:void(0);" onclick="CloseWidget()" style="margin-top: -10px; color: #4E8ABE;">' + (reload ? '刷新' : '关闭窗口') + '</a></div></div>');
    document.write('<script type="text/javascript">setTimeout("CloseWidget()", 5000);</script>');
    document.close();
}以上代码即使删掉document.open()和document.close()也还是不行,执行第一句document.write()就会跳走。现在是执行第一句document.open()就会跳走。前台调用代码如下:
$.ajax({
    url: 'http://api.ijie.com/...',   //这里就不全显示了
    data: { data: Data },
    type: snsShareInfo.Type,
    dataType: 'jsonp',
    complete: function () { showMessage('成功'); },
});
    
那位高手有时间请帮忙看看,小弟感激不尽。

解决方案 »

  1.   

    已经调试过了,每当执行到document.write 或者document.open就会跳走不往下执行。
      

  2.   

    那个iframe里面是空白的,什么都没有在里面
      

  3.   

    document.write("<link href='http://content1.ijie.cn/zh-CN/20110823/style/snsconnector/askform.css' type='text/css' rel='stylesheet'/>");
     你这样试试
      

  4.   

    童鞋 你把meta标签换成 <meta http-equiv="X-UA-Compatible" content="IE=8" />    我没IE9,你弄了看看应该行 结果告诉我
      

  5.   

    大哥,我试过了。效果还是一样,这个的意思是不是在IE9下面兼容IE8模式?但我现在是IE8反而可以,IE9不行...出来的iframe还是一片空白...求救啊
      

  6.   

    已经找到替代方案了,我用jquery代替document.write 生成了各个节点,然后append到body上。比document.write这种暴力方式更好,而且更加清晰。
    而且我在外国的网站上看到有人跟我有同样的问题,都是IE9不行。最终还是不知道具体原因,如果有高手知道,请指点指点。
    还是很感谢各位的回答,虽然没有给我最终的答案。但找到替代方案还是很开心,分数会照样给你们,谢谢!!