js实现下拉菜单自动隐藏 我的代码那里出了问题
<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/...
<!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>无标题文档</title>
<style>
#close{overflow:hidden}
#open{overflow:visible}
dl dt{display:block; }
dl{
height:20px;
float:left;
}
dl dd{
display:block;
}
</style>
<script language="javascript">
function list(onode){
var b=onode.parentNode;
var c=document.getElementsByTagName("dl");
for(i=0; i<c.length; i++)
{
if(c[i]=b)
{
if( b.className="close"){
b.className="close";}
else{
b.className="open";}
}
else
{
c[i].className="close";
}
}
}
</script>
</head>
<body>
<div>
<dl id="close">
<dt onmouseover="list(this)" onmouseout="list(this)">链接1</dt>
<dd>新闻一</dd>
<dd>新闻二</dd>
<dd>新闻三</dd>
<dd>新闻四</dd>
</dl>
<dl id="close">
<dt onmousemove="list(this)" onmouseout="list(this)">链接二</dt>
<dd>新闻一</dd>
<dd>新闻二</dd>
<dd>新闻三</dd>
<dd>新闻四</dd>
</dl>
<dl id="close">
<dt onmousemove="list(this)" onmouseout="list(this)">链接三</dt>
<dd>新闻一</dd>
<dd>新闻二</dd>
<dd>新闻三</dd>
<dd>新闻四</dd>
</dl>
</div>
</body>
</html>
鼠标划上去出现下拉框 移走鼠标消失 展开
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style>
#close{overflow:hidden}
#open{overflow:visible}
dl dt{display:block; }
dl{
height:20px;
float:left;
}
dl dd{
display:block;
}
</style>
<script language="javascript">
function list(onode){
var b=onode.parentNode;
var c=document.getElementsByTagName("dl");
for(i=0; i<c.length; i++)
{
if(c[i]=b)
{
if( b.className="close"){
b.className="close";}
else{
b.className="open";}
}
else
{
c[i].className="close";
}
}
}
</script>
</head>
<body>
<div>
<dl id="close">
<dt onmouseover="list(this)" onmouseout="list(this)">链接1</dt>
<dd>新闻一</dd>
<dd>新闻二</dd>
<dd>新闻三</dd>
<dd>新闻四</dd>
</dl>
<dl id="close">
<dt onmousemove="list(this)" onmouseout="list(this)">链接二</dt>
<dd>新闻一</dd>
<dd>新闻二</dd>
<dd>新闻三</dd>
<dd>新闻四</dd>
</dl>
<dl id="close">
<dt onmousemove="list(this)" onmouseout="list(this)">链接三</dt>
<dd>新闻一</dd>
<dd>新闻二</dd>
<dd>新闻三</dd>
<dd>新闻四</dd>
</dl>
</div>
</body>
</html>
鼠标划上去出现下拉框 移走鼠标消失 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询