iframe跨域自适应高度

duhaiping 2009-12-09 04:18:56
请教以下代码中iframe自适应高度问题,百度了很久都没找到能解决的.

<!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=gb2312" />
<title>无标题文档</title>
<style type="text/css">
body {
background-attachment:fixed;
margin: 0px;
}
#bottomNav {
z-index:999;
position:fixed;/*FireFox */
top: 0px;/*FireFox */
left:0;
right:0;
width:100%;
_position:absolute; /* for IE6 */
_top: expression(documentElement.scrollTop + documentElement.clientHeight-this.offsetHeight); /* for IE6 */
overflow:visible;
}
.nav{
width:960px;
margin-right: auto;
margin-left: auto;
}
.text{
width:930px;
background-color: #CCCCCC;
float: left;
}
.link{
width:30px;
background-color: #CCCCCC;
float: right;
text-align: center;
text-decoration: none;
}
#ifr{
width:100%;
}
</style>

<script type="text/javascript">
function showHideDIV(){
var doc = document.getElementById("Maple");
doc.style.display =
(doc.style.display == "none"?"block":"none");
}

</script>

</head>

<body>

<div id="bottomNav">
<div class="nav">
<div id="Maple" class="text">固定漂浮物在此处O(∩_∩)O~</div><div class="link"><a href="javascript:void(0);" onclick="showHideDIV()">显</a></div>
</div>
</div>

<iframe src="http://www.youku.com" scrolling="no" frameborder="0" id="ifr"></iframe>

</body>
</html>


怎么才能使iframe自适应高度?
...全文
63 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
TaoTaoYou 2009-12-10
  • 打赏
  • 举报
回复
建议参阅:http://www.web666.net/html/iframe.html
cloudgamer 2009-12-09
  • 打赏
  • 举报
回复
不行的

87,993

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧