急!在网页中浮动的静止层如何实现相对于浏览器窗口的位置不变?

FranklinBHU 2001-12-19 11:03:18
十万火急
...全文
205 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
taciya 2001-12-20
  • 打赏
  • 举报
回复
<script language="javascript">
<!--
function stat(){
var a = pageYOffset+window.innerHeight-document.bar.document.height-15
document.bar.top = a
setTimeout('stat()',2)
}
function fix(){
nome=navigator.appName
if(nome=='Netscape'){
stat()
}
else{
var a=document.body.scrollTop+document.body.clientHeight-document.all.bar.offsetHeight
bar.style.top = a
}}
//-->
</script>

<body onLoad="fix()" onScroll="fix()" onResize="fix()">
<table border="1" hspace="1" cellpadding="1" bgcolor="c0c0c0" width="80%" id="bar" style="position:absolute;width:100%; height:25px;z-index:9;margin:0">
<tr align="center">
<td width="25%"> <a href="#">首 页 </a></td>
<td width="25%"> <a href="#">你 好</a></td>
<td width="25%"> <a href="#">他 好</a></td>
<td width="25%"> <a href="#">我 好</a>
</td>
</tr>
</table>

87,996

社区成员

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

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