dreamweaver如何制作鼠标经过触发点(文字或者图片)显示层,鼠标离开触发点,隐藏层?
如题,像微软这个网站的导航栏http://www.microsoft.com/zh/cn/default.aspx...
如题,像微软这个网站的导航栏http://www.microsoft.com/zh/cn/default.aspx
展开
3个回答
展开全部
标签检测器中——行为——显示隐藏
会自动生成 js脚本的
显示层 需要定义 id
例子:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Menu</title>
<script type="text/javascript">
<!--
function MM_showHideLayers() { //v9.0
var i,p,v,obj,args=MM_showHideLayers.arguments;
for (i=0; i<(args.length-2); i+=3)
with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
obj.visibility=v; }
}
//-->
</script>
<style>
body {
margin: 0px;
background: #ccc;
}
#Menu {
width: 800px;
height: 25px;
float: left;
background: #eee;
padding: 5px 0 0 20px;
}
#subMenu {
width: 80px;
height: 25px;
line-height: 25px;
float: left;
background: #f9f9f9;
margin: 0 0 0 8px;
text-align: center;
border: 1px #f00 solid;
border-bottom: 0px;
}
#abc, #bac {
width: 150px;
visibility: hidden;
background: #f9f9f9;
position: absolute;
margin: 22px 0 0 -61px;
float: left;
border: 1px #f00 solid;
}
#abc li, #bac li {
width: 150px;
float: left;
text-align: left;
}
</style>
</head>
<body>
<ul id="Menu">
<li id="subMenu" onmouseover="MM_showHideLayers('abc','','show','bac','','hide')">1111
<ul id="abc">
<li>aaaaaaaaa</li>
<li>bbbbbbbbb</li>
<li>ccccccccc</li>
</ul>
</li>
<li id="subMenu" onmouseover="MM_showHideLayers('abc','','hide','bac','','show')">2222
<ul id="bac">
<li>ddddddddd</li>
<li>eeeeeeeee</li>
<li>fffffffff</li>
</ul>
</li>
</ul>
</body>
</html>
随便做了一个,具体样式自己做吧~
会自动生成 js脚本的
显示层 需要定义 id
例子:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Menu</title>
<script type="text/javascript">
<!--
function MM_showHideLayers() { //v9.0
var i,p,v,obj,args=MM_showHideLayers.arguments;
for (i=0; i<(args.length-2); i+=3)
with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
obj.visibility=v; }
}
//-->
</script>
<style>
body {
margin: 0px;
background: #ccc;
}
#Menu {
width: 800px;
height: 25px;
float: left;
background: #eee;
padding: 5px 0 0 20px;
}
#subMenu {
width: 80px;
height: 25px;
line-height: 25px;
float: left;
background: #f9f9f9;
margin: 0 0 0 8px;
text-align: center;
border: 1px #f00 solid;
border-bottom: 0px;
}
#abc, #bac {
width: 150px;
visibility: hidden;
background: #f9f9f9;
position: absolute;
margin: 22px 0 0 -61px;
float: left;
border: 1px #f00 solid;
}
#abc li, #bac li {
width: 150px;
float: left;
text-align: left;
}
</style>
</head>
<body>
<ul id="Menu">
<li id="subMenu" onmouseover="MM_showHideLayers('abc','','show','bac','','hide')">1111
<ul id="abc">
<li>aaaaaaaaa</li>
<li>bbbbbbbbb</li>
<li>ccccccccc</li>
</ul>
</li>
<li id="subMenu" onmouseover="MM_showHideLayers('abc','','hide','bac','','show')">2222
<ul id="bac">
<li>ddddddddd</li>
<li>eeeeeeeee</li>
<li>fffffffff</li>
</ul>
</li>
</ul>
</body>
</html>
随便做了一个,具体样式自己做吧~
展开全部
标签检测器中——行为——显示隐藏
会自动生成 js脚本的
显示层 需要定义 id
例子:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Menu</title>
<script type="text/javascript">
<!--
function MM_showHideLayers() { //v9.0
var i,p,v,obj,args=MM_showHideLayers.arguments;
for (i=0; i<(args.length-2); i+=3)
with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
obj.visibility=v; }
}
//-->
</script>
<style>
body {
margin: 0px;
background: #ccc;
}
#Menu {
width: 800px;
height: 25px;
float: left;
background: #eee;
padding: 5px 0 0 20px;
}
#subMenu {
width: 80px;
height: 25px;
line-height: 25px;
float: left;
background: #f9f9f9;
margin: 0 0 0 8px;
text-align: center;
border: 1px #f00 solid;
border-bottom: 0px;
}
#abc, #bac {
width: 150px;
visibility: hidden;
background: #f9f9f9;
position: absolute;
margin: 22px 0 0 -61px;
float: left;
border: 1px #f00 solid;
}
#abc li, #bac li {
width: 150px;
float: left;
text-align: left;
}
</style>
</head>
<body>
<ul id="Menu">
<li id="subMenu" onmouseover="MM_showHideLayers('abc','','show','bac','','hide')">1111
<ul id="abc">
<li>aaaaaaaaa</li>
<li>bbbbbbbbb</li>
<li>ccccccccc</li>
</ul>
</li>
<li id="subMenu" onmouseover="MM_showHideLayers('abc','','hide','bac','','show')">2222
<ul id="bac">
<li>ddddddddd</li>
<li>eeeeeeeee</li>
<li>fffffffff</li>
</ul>
</li>
</ul>
</body>
</html>
会自动生成 js脚本的
显示层 需要定义 id
例子:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Menu</title>
<script type="text/javascript">
<!--
function MM_showHideLayers() { //v9.0
var i,p,v,obj,args=MM_showHideLayers.arguments;
for (i=0; i<(args.length-2); i+=3)
with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
obj.visibility=v; }
}
//-->
</script>
<style>
body {
margin: 0px;
background: #ccc;
}
#Menu {
width: 800px;
height: 25px;
float: left;
background: #eee;
padding: 5px 0 0 20px;
}
#subMenu {
width: 80px;
height: 25px;
line-height: 25px;
float: left;
background: #f9f9f9;
margin: 0 0 0 8px;
text-align: center;
border: 1px #f00 solid;
border-bottom: 0px;
}
#abc, #bac {
width: 150px;
visibility: hidden;
background: #f9f9f9;
position: absolute;
margin: 22px 0 0 -61px;
float: left;
border: 1px #f00 solid;
}
#abc li, #bac li {
width: 150px;
float: left;
text-align: left;
}
</style>
</head>
<body>
<ul id="Menu">
<li id="subMenu" onmouseover="MM_showHideLayers('abc','','show','bac','','hide')">1111
<ul id="abc">
<li>aaaaaaaaa</li>
<li>bbbbbbbbb</li>
<li>ccccccccc</li>
</ul>
</li>
<li id="subMenu" onmouseover="MM_showHideLayers('abc','','hide','bac','','show')">2222
<ul id="bac">
<li>ddddddddd</li>
<li>eeeeeeeee</li>
<li>fffffffff</li>
</ul>
</li>
</ul>
</body>
</html>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
如果是静态的话只需要少量的js代码就可以实现了
如果是动态数据的话需要AJAX+数据库了
如果是动态数据的话需要AJAX+数据库了
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询