您的位置:首页 > 其它

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

2010-05-26 22:43 417 查看
为兼容ie、firefox特别做了如下处理:

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.csdn.net/BiologyPianoProgram/archive/2009/04/23/4103062.aspx





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

http://540079673.blog.163.com/blog/static/12071647620103211042804/" target=_blank>url: http://540079673.blog.163.com/blog/static/12071647620103211042804/
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: