25、浮动顶层的菜单A
类别: JavaScript教程
====1、将以下代码加入HTML的<head></head>之间:
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function setVariables() {
if (navigator.appName == "Netscape") {
v=".top=";
dS="document.";
sD="";
y="window.pageYOffset";
}
else {
v=".pixelTop=";
dS="";
sD=".style";
y="document.body.scrollTop";
}
}
function checkLocation() {
object="object1";
yy=eval(y);
eval(dS+object+sD+v+yy);
setTimeout("checkLocation()",10);
}
// End -->
</script>
====2、将以下代码加入HTML的<body></body>之间:
<BODY OnLoad="setVariables();checkLocation()">
<div id="object1" style="position:absolute; visibility:show; left:0px; top:0px; z-index:2">
<table width=128 border=0 cellspacing=20 cellpadding=0>
<tr>
<td height="97"><a href="地址1.htm"><img src="图片1.gif" width="105" height="21" border="0"></a><br>
<a href="地址2.htm"><img src="图片2.gif" width="105" height="21" border="0"></a><br>
<a href="地址3.htm"><img src="图片3.gif" width="105" height="21" border="0"></a><br>
<a href="地址4.htm"><img src="图片4.gif" width="105" height="21" border="0"></a>
</td>
</tr>
</table>
</div></BODY>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function setVariables() {
if (navigator.appName == "Netscape") {
v=".top=";
dS="document.";
sD="";
y="window.pageYOffset";
}
else {
v=".pixelTop=";
dS="";
sD=".style";
y="document.body.scrollTop";
}
}
function checkLocation() {
object="object1";
yy=eval(y);
eval(dS+object+sD+v+yy);
setTimeout("checkLocation()",10);
}
// End -->
</script>
====2、将以下代码加入HTML的<body></body>之间:
<BODY OnLoad="setVariables();checkLocation()">
<div id="object1" style="position:absolute; visibility:show; left:0px; top:0px; z-index:2">
<table width=128 border=0 cellspacing=20 cellpadding=0>
<tr>
<td height="97"><a href="地址1.htm"><img src="图片1.gif" width="105" height="21" border="0"></a><br>
<a href="地址2.htm"><img src="图片2.gif" width="105" height="21" border="0"></a><br>
<a href="地址3.htm"><img src="图片3.gif" width="105" height="21" border="0"></a><br>
<a href="地址4.htm"><img src="图片4.gif" width="105" height="21" border="0"></a>
</td>
</tr>
</table>
</div></BODY>
- 上一篇: 24、推拉门式菜单
- 下一篇: 26、浮动顶层的菜单B
-= 资 源 教 程 =-
文 章 搜 索