★★ 总结:获取 Iframe内的元素对象,兼容ie、firefox

本文详细解析了如何在使用iframe时确保在Firefox和IE浏览器间的一致性,包括JavaScript调用、样式设置、滚动条权限等问题的解决策略。

为兼容iefirefox特别做了如下处理:

if(navigator.appName == "Netscape") {//firefox等兼容

document.getElementById("historyframe").contentDocument.getElementById("ChatList").innerHTML +="abc";

}else{//ie兼容

document.frames("historyframe").ChatList.innerHTML +="abc";

}

注意,这里的的“ChatList”是chatList.jsp中的div:<div id='ChatList'></div>

<iframe name="historyframe" id="historyframe" style="margin-left:0;margin-right:0px;background-color:ivory;" frameborder="0" width="100%" height="100%" src="<%=path %>/jsp/customer/chatList.jsp"></iframe>

其他iframe资料:

Firefox 和 IE JavaScript兼容性

url:http://pengchb2002.blog.163.com/blog/static/1618824120085171132903/

1.iframe 调用子页面的函数
IE:iframeId.function
FF:document.getElementById("iframeId").contentWindow.function
ps:FF: window 为contentWindow; document 为contentDocument

2.class 属性
IE:obj.setAttribute("className","style");
FF:obj.setAttribute("class","style");
3.获取document.scrollHeight权限出错
通过Iframe操作scroll相关属性和行为时,如果src的资源和父页面不部署在同一应用下,会报此错误

学习HTML:iframe用法总结

url:http://blog.youkuaiyun.com/BiologyPianoProgram/archive/2009/04/23/4103062.aspx

真正的iframe高度自适应(兼容IE,FF,Opera)

url: http://540079673.blog.163.com/blog/static/12071647620103211042804/

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值