一个比较酷的CSS生成带提示的菜单

王朝html/css/js·作者佚名  2006-11-24
窄屏简体版  字體: |||超大  

有什么问题请到<a href='/bbs/forums.php?fid=21'>论坛</a>中发表<br>

<!-- http://www.webjx.com/js -->

<!-- bbs http://www.webjx.com/bbs-->

<!-- 把下列代码加入到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.webjx.com" onMouseover="showtext('JavaScript tutorials and scripts!')" onMouseout="hidetext()">webjx.com</a>

<a href="http://www.webjx.com/js/" onMouseover="showtext('300+ free JavaScripts')" onMouseout="hidetext()">webjx.com</a>

<a href="http://www.webjx.com/jsref/" onMouseover="showtext('Comprehensive JavaScript Reference')" onMouseout="hidetext()">webjx.com</a>

<a href="http://bbs.webjx.com" onMouseover="showtext('Web coding and development forums!')" onMouseout="hidetext()">webjx Forums</a>

<a href="http://www.webjx.com" onMouseover="showtext('Award winning DHTML and JavaScripts')" onMouseout="hidetext()">webjx.com</a>

<div id="tabledescription"></div>

</div>

[Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航