小弟在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('成功'); },
});
那位高手有时间请帮忙看看,小弟感激不尽。
尝试过用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('成功'); },
});
那位高手有时间请帮忙看看,小弟感激不尽。
解决方案 »
- Javascripters又一力作,80行代码高可配置AjaxTab(有例子,配详细说明)
- onmousemove的标签嵌套问题
- 报javascript错: 未指明的错误
- <!-- --> 只是习惯么?
- 请教一个关于js的问题,马上揭贴
- 100分求救~~~!!innerHTML带来的问题
- 请问有没有javascript特效讲解的教程
- 帮忙给弄一个关于数字排列的算法呗~~~
- 如何将html页面里的text输入框的值和它周围的信息一起取出来
- 一个简单的代码位置的问题(easyui)
- webqq用的是什么技术呀,真与桌面区别不大呀?(桌面版快没存在价值了)
- ckeditor 3.5.3 添加中文命名的flase不能显示该怎么处理?急急急!
你这样试试
而且我在外国的网站上看到有人跟我有同样的问题,都是IE9不行。最终还是不知道具体原因,如果有高手知道,请指点指点。
还是很感谢各位的回答,虽然没有给我最终的答案。但找到替代方案还是很开心,分数会照样给你们,谢谢!!