在Firefox下JQuery处理iframe时的问题
来源:互联网 发布:微信话费充值源码 编辑:程序博客网 时间:2024/06/06 00:48
想动态进行加载iframe的内容,以实现点击注册以后,将注册页面通过iframe显示出来。
于是想到了JQuery的,attr('src','url')方法。代码如下:
JS:
$('#register').click(function(){ $("#bg").css('display','block'); $("#doing").css('display','block'); $("#content > iframe").attr("src","register.php"); $("#content > iframe").load(function(){ $("#doing").css('display','none'); $("#content").css('display','block'); });});
HTML:
<div id="bg" class="bg" style="display:none"><div id="drag" class="dialog" style="-moz-user-select: none;"><div class="control" style="-moz-user-select: none;"><a id="closeDialog" href="javascript:void(0);"><img src="style/images/dialogclose.png"></a></div><div id="doing" class="doing" style="display:none">载入中...</div><div id="content" class="content" style="display:none"><iframe class="frm" src=""></iframe></div></div></div>
过程是点击注册以后,先显示遮罩层,把后面的内容遮住,再显示doing层,这个时候执行 $("#content > iframe").attr("src","register.php"); 设置iframe的src属性,然后判断加载完毕以后,隐藏doing层,显示内容层。最终页面显示完毕。
这个过程在IE 和 Chrome下都没有问题,但是在FireFox下,会出现iframe中的内容虽然加载完毕了,但是JS没有起作用。Firebug提示有这个错误:document.defaultView.getComputedStyle(h, null) is null
这个让人非常费解。
这里有一些解释:
http://groups.google.com/group/jquery-en/browse_thread/thread/2f5871105858b7f7
http://stackoverflow.com/questions/1683191/jquery-iframe-css-firefox-bug
这个问题在JQuery最新的版本已经修复了!
- 在Firefox下JQuery处理iframe时的问题
- firefox的iframe问题
- jQuery - 综合实例 - Pre标签在IE与Firefox下效果相对理想的换行处理
- Jquery.post方法在firefox浏览器不调用问题处理
- [DOM元素处理] 使用jQuery获取iframe元素的value属性值 IE-firefox可以用
- Firefox下调用iframe的js注意事项
- iframe的onfocus在firefox中失效?
- jquery操作iframe中的HTML 在IE6、Mozilla Firefox 正常
- jquery下控制iframe页面form提交的问题备忘
- chrome frame 在 iframe frameset 下无效 的处理方法
- jquery的load()在firefox下兼容问题(转)
- jQuery中Ajax在Firefox下“object XMLDocument”的解决办法
- 取frame和iframe对象在IE和Firefox下的兼容问题
- html在线编辑器的问题:firefox与iE在获得iframe内容的不同情况
- jquery uploadify在firefox上传附件存在的问题
- 最近碰到的一个firefox下table标签和iframe标签问题
- 在Linux下Firefox浏览器显示乱码的情况处理
- this.text在firefox和IE9下的容错处理
- Repeated column in mapping for entity: .... should be mapped with insert="false" update="false"
- Android: 向最强看齐, 反编译 愤怒的小鸟.apk
- 用c:forEach实现for(int i=0 ; i < 10 ; i++)
- jquerry实现9种弹出层的效果
- IPv4下的DHCP协议
- 在Firefox下JQuery处理iframe时的问题
- 在KEIL RVMDK 下为单一C文件生成.LIB文件
- gdb命令笔记
- 窗体样式小结
- 数据库
- 关于MovieClip类的对象
- Mysql
- tomcat修改端口号
- 为什么在VC6.0的编译器 编译后 总是出现这样一个错误Error spawning cl.exe .