添加收藏
 系统管理
 联系方式
  汉南在线网页设计HTML/CSS

一个比较酷的CSS生成带提示的菜单
作  者:匿名
关键字:CSS、DIV



<!-- 把下列代码加入到head区内 -->
<style type="text/css">

#coolmenu{
border: 1px solid black;
width: 170px;
background-color: #E6E6E6;
}

#coolmenu a{
font: bold 13px Verdana;
padding: 2px;
padding-left: 4px;
display: block;
width: 100%;
color: black;
text-decoration: none;
border-bottom: 1px solid black;
}

html>body #coolmenu a{
width: auto;
}

#coolmenu a:hover{
background-color: black;
color: white;
}

#tabledescription{
width: 100%;
height: 3em;
padding: 2px;
filter:alpha(opacity=0);
-moz-opacity:0;
}

</style>

<script type="text/javascript">


var baseopacity=0

function showtext(thetext){
if (!document.getElementById)
return
textcontainerobj=document.getElementById("tabledescription")
browserdetect=textcontainerobj.filters? "ie" : typeof textcontainerobj.style.MozOpacity=="string"? "mozilla" : ""
instantset(baseopacity)
document.getElementById("tabledescription").innerHTML=thetext
highlighting=setInterval("gradualfade(textcontainerobj)",50)
}

function hidetext(){
cleartimer()
instantset(baseopacity)
}

function instantset(degree){
if (browserdetect=="mozilla")
textcontainerobj.style.MozOpacity=degree/100
else if (browserdetect=="ie")
textcontainerobj.filters.alpha.opacity=degree
else if (document.getElementById  &&  baseopacity==0)
document.getElementById("tabledescription").innerHTML=""
}

function cleartimer(){
if (window.highlighting) clearInterval(highlighting)
}

function gradualfade(cur2){
if (browserdetect=="mozilla"  &&  cur2.style.MozOpacity<1)
cur2.style.MozOpacity=Math.min(parseFloat(cur2.style.MozOpacity)+0.2, 0.99)
else if (browserdetect=="ie"  &&  cur2.filters.alpha.opacity<100)
cur2.filters.alpha.opacity+=20
else if (window.highlighting)
clearInterval(highlighting)
}

</script>


<!-- 把下列代码加入到body区内 -->
<div id="coolmenu">
<a href="http://www.alixixi.com" onMouseover="showtext('JavaScript tutorials and scripts!')" onMouseout="hidetext()">alixixi.com</a>
<a href="http://www.alixixi.com/js/" onMouseover="showtext('300+ free JavaScripts')" onMouseout="hidetext()">alixixi.com</a>
<a href="http://www.alixixi.com/jsref/" onMouseover="showtext('Comprehensive JavaScript Reference')" onMouseout="hidetext()">alixixi.com</a>
<a href="http://bbs.alixixi.com" onMouseover="showtext('Web coding and development forums!')" onMouseout="hidetext()">webjx Forums</a>
<a href="http://www.alixixi.com" onMouseover="showtext('Award winning DHTML and JavaScripts')" onMouseout="hidetext()">alixixi.com</a>
<div id="tabledescription"></div>
</div>



来源:网络
阅读:15
日期:2008-5-12

【 双击滚屏 】 【 推荐朋友 】 【 收藏 】 【 打印 】 【 关闭 】 【 字体: 】 
上一篇:鼠标指向有背景的CSS导航菜单
下一篇:又一种新的CSS垂直导航代码

  >> 相关文章
 
  ·鼠标指向有背景的CSS导航菜单
  ·兰色背景变换的CSS导航菜单
  ·普通的导航链接条,但是加了CSS效果
  ·根据不同的浏览器调用不同的CSS设置
  ·CSS使用大全
  ·用鼠标感应来改变某个按钮的CSS属性
  ·用点击来改变文字或者图片的CSS属性
  ·用CSS滤镜打开图片的各种效果

5.12汶川大地震遇难同胞默哀 | 汉南在线总站 | 免费电影 | BT电影下载 | 东莞信息网 | 流行购商城

授权使用:汉南在线 http://hnzx.hzwz.net/
经营许可证:陕ICP备05000109号 Powered by:汉南在线
Copyright (c) 2002-2007 汉南在线. All Rights Reserved .