当前位置: 首页 > 图文教程 > 网络编程 > ASP > WEB页面实现淡入淡出菜单

ASP
对连串英文自动换行的解决方法 IE5.5
怎样写你自己的EMAIL组件(原理)
ASP中有关timeout超时的体会
用ASP实现从SQL Server导出数据到Access
ASP向NT域中加一个用户
ASP乱码的解决方法
关于 aspsmartupload 注册问题
利用XML不离开页面刷新数据
IIS 处理 SEARCH 请求漏洞
不用组件实现上载功能(1)
不用组件实现上载功能(2)
在网页中实现OICQ里的头像选择的下拉框
仅用xsl和asp实现分页功能
如何使用context()方法将数据置入表格(XML)
利用ASP从远程服务器上接收XML数据
将数据库里面的内容生成EXCEL
怎样在ASP里面创建统计图表
加密你的Access数据库
利用global.asp定时执行ASP
加密QueryString数据

ASP 中的 WEB页面实现淡入淡出菜单


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 26 ::
收藏到网摘: n/a

  (本文适合菜级网页制作者或初级WEB编程者阅读参考)
下面的程序还是简单的测试版。需要编程的整个思路和具体分析步骤的请Email到[email protected]

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title> 淡入淡出菜单演示 </title>
<style>
.sml_menu {font-size: 9pt; color: white; cursor: hand; font-family: Tahoma;}
.font3 {font-size: 10.5pt; color: 147e19; font-family: Courier New;}
.menuitem {font-size: 10.5pt; color: white; cursor: default; font-family: Courier New;}
</style>
<script language="javascript">
//LiveMenu Ver1.0 by [email protected]
//2000.11
var intDelay=50; //设置菜单显示速度,越大越慢,不超过100为好
var intInterval=5; //每次更改的透明度,最好小于10
//以下代码需要改的地方可以更改
function MenuClick()
{
if (LayerMenu.style.display=="")
{
LayerMenu.style.display="none"; //当菜单显示的时候单击就关闭菜单
}
else{
LayerMenu.filters.alpha.opacity=0;
LayerMenu.style.display="";
GradientShow(); //淡入
  }
}

function GradientShow() //实现淡入的函数
{
LayerMenu.filters.alpha.opacity+=intInterval;
if (LayerMenu.filters.alpha.opacity<100) setTimeout("GradientShow()",intDelay);
}

function GradientClose() //实现淡出的函数
{
LayerMenu.filters.alpha.opacity-=intInterval;
if (LayerMenu.filters.alpha.opacity>0) {
  setTimeout("GradientClose()",intDelay);
  }
else {
  LayerMenu.style.display="none"; //当看不到菜单层后还需要把这个层隐藏起来
  }
}

function ChangeBG() //改变菜单项的背景颜色,这里的两种颜色值可以改为你需要的
{
oEl=event.srcElement;
if (oEl.style.background!="navy") {
  oEl.style.background="navy";
  }
  else {
  oEl.style.background="#147e19";
  }
}

function ItemClick() //在菜单项上单击后打开相应链接
{
oEl=event.srcElement;
oLink=oEl.all.tags( "A" );
if( oLink.length )
{
oLink[0].click();
GradientClose();
}
}
</script>
</head>
<body onMouseover="GradientClose();">
<br>
<p align=center class=font3>LiveMenu V1.0 by [email protected]<br>请查看源代码<br>
请手动设置菜单层或菜单提示层的具体位置<br>
在: style="Position:Absolute;Left:???px;Top:???px;" 处设置</p>
<!--菜单提示层开始-->
<div style="Position:Absolute;Left:250px;Top:120px;" onClick="MenuClick()">
<table border=0 cellpadding=0 cellspacing=0 width=300><tr><td bgcolor=#147e19 class=sml_menu height=20 onselectstart="return false;">&nbsp;Click here to show the menu ... (单击显示菜单)</td></tr></table>
</div>
<!--菜单提示层结束-->
</body>
<!--菜单层开始-->
<div id=LayerMenu style="Position:Absolute;Left:250px;Top:137px;Display:none;filter:alpha(opacity=0);" oncontextmenu="return false" onMouseover="window.event.cancelBubble = true;">
<!--上面一行的onMouseover事件是很关键的-->
<table border=0 cellpadding=0 cellspacing=0 bgcolor=147e19>
<tr><td height=1 bgcolor=#f0f0f0 colspan=2></td></tr>
<tr><td width=20 valign=bottom bgcolor=navy></td>
<td>
<table border=0 width=200 cellpadding=0 cellspacing=0 onselectstart="return false;" onclick="ItemClick();" onMouseover="ChangeBG();" onMouseout="ChangeBG();">
  <tr><td class=menuitem height=20 style="background: 147e19;"><a href=/First></a>1.The First Menu Item</td></tr>
&n