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

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

 

 

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

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

你可能感兴趣的:(JavaScript,iframe,IE,url,firefox,scroll)