您好网科网络欢迎您-西安网站建设您好,网科创想为您服务-西安网站制作西安网站建设专家  
首页经典案例网站制作软件开发 域名主机网站推广联系我们
      技术资料
css下拉菜单
发布:2010-03-06 ...  来源: 西安网科网络科技有限公司 转载请注明:来自网科创想

<style type="text/css">
.anylinkcss{
position:absolute;
visibility: hidden;
border:1px solid black;
border-bottom-width: 0;
font:normal 12px Verdana;
line-height: 18px;
z-index: 100;
background-color: #E9FECB;
width: 205px;
}

.anylinkcss a{
width: 100%;
display: block;
text-indent: 3px;
border-bottom: 1px solid black;
padding: 1px 0;
text-decoration: none;
font-weight: bold;
text-indent: 5px;
}

.anylinkcss a:hover{ /*hover background color*/
background-color: black;
color: white;
}

</style>
<script language="javascript">
var disappeardelay=250  //menu disappear speed onMouseout (in miliseconds)
var enableanchorlink=0 //Enable or disable the anchor link when clicked on? (1=e, 0=d)
var hidemenu_onclick=1 //hide menu when user clicks within menu? (1=yes, 0=no)

/////No further editting needed

var ie5=document.all
var ns6=document.getElementById&&!document.all

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}

function showhide(obj, e, visible, hidden){
if (ie5||ns6)
dropmenuobj.style.left=dropmenuobj.style.top=-500
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie5 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var windowedge=ie5 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
}
return edgeoffset
}

function dropdownmenu(obj, e, dropmenuID){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
if (typeof dropmenuobj!="undefined") //hide previous menu
dropmenuobj.style.visibility="hidden"
clearhidemenu()
if (ie5||ns6){
obj.onmouseout=delayhidemenu
dropmenuobj=document.getElementById(dropmenuID)
if (hidemenu_onclick) dropmenuobj.onclick=function(){dropmenuobj.style.visibility='hidden'}
dropmenuobj.onmouseover=clearhidemenu
dropmenuobj.onmouseout=ie5? function(){ dynamichide(event)} : function(event){ dynamichide(event)}
showhide(dropmenuobj.style, e, "visible", "hidden")
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
}
return clickreturnvalue()
}

function clickreturnvalue(){
if ((ie5||ns6) && !enableanchorlink) return false
else return true
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function dynamichide(e){
if (ie5&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function delayhidemenu(){
delayhide=setTimeout("dropmenuobj.style.visibility='hidden'",disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}
</script>

<!--第一个链接和菜单 -->
<a href="#" onClick="return clickreturnvalue()" onMouseover="dropdownmenu(this, event, 'anylinkmenu1')">网页特效</a>  
                                                   
<div id="anylinkmenu1" class="anylinkcss">

<a href="#">图形图像</a>
<a href="#">鼠标事件</a>
<a href="#">时间日期</a>
<a href="#">导航菜单</a>
<a href="#">窗体变化</a>
<a href="#">表单按钮</a>
<a href="#">特殊脚本</a>
<a href="#">游戏娱乐</a>
</div>

<!--第二个链接和菜单 -->

 <a href="#" onClick="return clickreturnvalue()" onMouseover="dropdownmenu(this, event, 'anylinkmenu2')">网络学院</a>  
                                                   
<div id="anylinkmenu2" class="anylinkcss" style="width: 150px; background-color: lightyellow">

<a href="#">网页制作</a>
<a href="#">网络编程</a>
<a href="#">图形图像</a>
<a href="#">多媒体制作</a>
<a href="#">网站建设</a>
<a href="#">操作系统</a>
</div>

 
1/不超过10个页面
2/国际域名,300M空间
3/内含新闻系统、产品系统、在线互动
4/免费站点统计、傻瓜式后台操作
1/精美页面设计(可含FLASH)
2/国际域名,500M空间
3/内含信息发布系统、产品管理系统...
4/可含多级分类、提供域名备案...
1/精美页面设计(可含FLASH)
2/国际域名,1G商务主机
3/web最流行语言PHP开发...
4/免费终身维护、提供域名备案...
网站建设专线: 029-85458571
网站改版专线: 13379086051
网站推广专线: 029-85075855
技术支持专线: 15319961940
公司服务专线: 029-85458571
公司传真号码: 029-85458571
 QQ: 494145261 360811363
  309824428 549966588
php0@qq.com php-5@qq.com
网址: www.xanet.net www.xawk.net
地址: 西安市雁塔北路8号万达广场
  一栋二单元20712室


首页 | 经典案例 | 网站制作 | 软件开发 | 域名主机 | 网站推广 | 联系我们 | 技术资料 | 网科CRM
版权所有:西安网科网络科技有限公司-西安网站建设  地址:西安市雁塔北路8号万达广场一栋二单元0712室
客服电话:029-85458571  销售:15319961940  售后:13379086051
陕ICP备09020140号 传真:029-85458571