iframe自适应学习一例子

首先感谢 http://www.ccvita.com/376.html 现在说下跨域的iframe 自适应,
代码下载 http://www.ccvita.com/usr/uploads/demo/iframe/iframe.zip
解压后 main.html 和 agent.html 是在一个域名下,假设a.com
iframe.html 在另外域名下假设 b.com

A 站a.com 在main.html 里面用iframe框住b.com 下的iframe.html
iframe1

agent.html 直接上传就可以 B站 b.com 在b.com 下的iframe.html 里面要加入

 
function sethash(){     
hashH = document.documentElement.scrollHeight;      
urlC = "http://a.com/agent.html"; //注意这里!!!     
document.getElementById("iframeC").src=urlC+"#"+hashH; 
} 
window.onload=sethash;

在IE6、IE7、IE8、IE9、Firefox全系列、Chrome全系列均可以成功跨域控制高度