DIV CSS 佈局教程網

 DIV+CSS佈局教程網 >> 網頁腳本 >> CSS入門知識 >> CSS詳解 >> 一個比較酷的CSS生成帶提示的菜單
一個比較酷的CSS生成帶提示的菜單
編輯:CSS詳解     

<!-- 把下列代碼加入到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.knowsky.com" onMouSEOver="showtext('JavaScript tutorials and scripts!')" onMouSEOut="hidetext()">knowsky.com</a>
<a href="http://www.knowsky.com/JS/" onMouSEOver="showtext('300+ free JavaScripts')" onMouSEOut="hidetext()">knowsky.com</a>
<a href="http://www.knowsky.com/JSref/" onMouSEOver="showtext('Comprehensive JavaScript Reference')" onMouSEOut="hidetext()">knowsky.com</a>
<a href="http://bbs.knowsky.com" onMouseover="showtext('Web coding and development forums!')" onMouSEOut="hidetext()">knowsky Forums</a>
<a href="http://www.knowsky.com" onMouSEOver="showtext('Award winning DHtml and JavaScripts')" onMouSEOut="hidetext()">knowsky.com</a>
<div id="tabledescription"></div>
</div>

XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved