明天的明天 永远的永远 未知的一切 我与你一起承担 ??

是非成败转头空 青山依旧在 几度夕阳红 。。。
随笔 - 1277, 文章 - 0, 评论 - 214, 阅读 - 321万
  博客园  :: 首页  :: 管理
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
网站top菜单栏都是一样的,

 这里面除了div和iframe之外,还需要一段自适应高度的教本。div层就是放网页顶部的菜单栏,iframe部分是子窗体。我把主页的代码复制如下:

<html> 
    <head> 
       <title>iframe自适应加载的页面高度</title> 

<script language="Javascript">
var getFFVersion=navigator.userAgent.substring

(navigator.userAgent.indexOf("Firefox")).split("/")[1]
//extra height in px to add to iframe in FireFox 1.0+ browsers
var FFextraHeight=getFFVersion>=0.1? 16 : 0

function dyniframesize(iframename) {
  var pTar = null;
  if (document.getElementById){
    pTar = document.getElementById(iframename);
  }
  else{
    eval('pTar = ' + iframename + ';');
  }
  if (pTar && !window.opera){
    //begin resizing iframe
    pTar.style.display="block"
   
    if (pTar.contentDocument &&

pTar.contentDocument.body.offsetHeight){
      //ns6 syntax
      pTar.height =

pTar.contentDocument.body.offsetHeight+FFextraHeight;
    }
    else if (pTar.Document && pTar.Document.body.scrollHeight){
      //ie5+ syntax
      pTar.height = pTar.Document.body.scrollHeight;
    }
  }
}
</script> </head> 

<body>
<div class="phdn" align=center>
 <a href="#" target="main">资讯首页</a>
 |
 <a href="child1.htm" target="main">财经</a>
 |
 <a href="child2.htm" target="main">体育</a>
 |
 <a href="child3.htm" target="main">娱乐</a>
 |
 <a href="child4.htm" target="main">汽车</a>
 |
 <a href="child5.htm" target="main">房产</a>
 |
 <a href="child6.htm" target="main">科技</a>
 |
 <a href="child7.htm" target="main">访谈</a>
 |
 <a href="child8.htm" target="main">旅游</a>
 |
 <a href="child9.htm" target="main">社会</a>
 |
 <a href="child10.htm" target="main">社区</a>
</div>
       <iframe id="myTestFrameID" name="main"  onload="javascript:{dyniframesize('myTestFrameID');}" 
                 marginwidth=0 marginheight=0 frameborder=0  scrolling=no src="child1.htm"  width=100% ></iframe>

 </body></html>

  

 

//*****************

// child.htm就是需要替换的子窗体。

编辑推荐:
· AI与.NET技术实操系列:基于图像分类模型对图像进行分类
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
阅读排行:
· 25岁的心里话
· 闲置电脑爆改个人服务器(超详细) #公网映射 #Vmware虚拟网络编辑器
· 零经验选手,Compose 一天开发一款小游戏!
· 因为Apifox不支持离线,我果断选择了Apipost!
· 通过 API 将Deepseek响应流式内容输出到前端
历史上的今天:
2007-05-17 在.net中使用xmlhttp组件读取网页源码
2006-05-17 初学ASP.Net时一些备忘的东西
2006-05-17 如何给Asp.Net表格或控件加上自定义的提示框?
2006-05-17 如何显示在线人数,和所在位置?? [转自作者:子扬]
点击右上角即可分享
微信分享提示