首页 | 新闻 | 网站建设 | 成功案例 | 服务项目 | 商业购买 | 编程技术 | 壁纸 | 休闲娱乐 | 下载专区 | 留言 | 论坛
 
您现在的位置:网站首页 > 编程技术 > JavaScript
Iframe框架自动适应宽度和高度 IE与Firefox 下测试通过
发布时间:2008-03-29  发布:奇景  关键字:ie iframe 框架 高度  阅读次数:330  【字号
只需修改框架页
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>iframe</title>
</head>
<body>
<script type="text/javascript">
 
function SetCwinHeight(){
  
var bobo=document.getElementById("bobo"); //iframe id
  if (document.getElementById){
   
if (bobo && !window.opera){
    
if (bobo.contentDocument && bobo.contentDocument.body.offsetHeight){
     bobo.height 
= bobo.contentDocument.body.offsetHeight;
    }
else if(bobo.Document && bobo.Document.body.scrollHeight){
     bobo.height 
= bobo.Document.body.scrollHeight;
    }
   }
  }
 }
</script>
<iframe width="100%" id="bobo" onload="Javascript:SetCwinHeight()" height="1" frameborder="0" src="http://www.google.com"></iframe>
这里有什么?
</body>
</html>

转自子鼠:http://www.zishu.cn/
【收藏此页】【复制网址】【打印】【关闭】返回上一级
 ≡相关主题≡
 
分类导航
本类最新
本周热门

  版权声明 | 关于本站 | 常见问题 | 联系我们 | 网站管理 | 页面顶端
CopyRight ? QScms.cn All Rights Reserved 福州帝威荣信息技术有限公司研发 业务联系:0591-87522535
互联网许可证:闽ICP备08002627号 QQ:812188106 邮箱:qscms@yahoo.cn
Power By QsCMS V3.0  执行时间 : 0.016 秒 页面装载: