下拉菜单怎么实现点击任何地方都关闭啊?现在只有点X才能关
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<!-- saved from url=(0021)http://www.hao123.com/ -->
<HTML><HEAD><TITLE>百度一下,你就知道</TITLE>
<META http-equiv=Content-Type content=text/html;charset=gb2312>
</head><style type="text/css">
.m{
border:1px solid #CCFF33;
width:10px;
float: right;
}
.z{
border:1px dotted #00CCFF;
width:50px;
top: 12px;
right: -60px;
position: absolute;
position:absolute;
}
ul{
padding:0;
margin:0;
list-style:none;
display:none;
float: right;
}
.kk{
border: thin solid #006699;
width: 250px;
height: 50px;
position: relative;
}
.body{
text-align: center;
}
</style>
<body><div class="kk">
<div class="m" onClick="show()">x</div>
<ul class="z" id="sL">
<li>yyyyyyy</li>
<li>yyyyyyy</li>
<li>yyyyyyy</li>
<li>yyyyyyy</li>
<li>yyyyyyy</li>
</ul>
</div>
<div class="kk"></div>
</body>
<script>
function show()
{
var tag = document.getElementById("sL")
if (tag.style.display=="none")
{
tag.style.display = "block"
}else{
tag.style.display = "none"
}
}
</script>
</html>
<!-- saved from url=(0021)http://www.hao123.com/ -->
<HTML><HEAD><TITLE>百度一下,你就知道</TITLE>
<META http-equiv=Content-Type content=text/html;charset=gb2312>
</head><style type="text/css">
.m{
border:1px solid #CCFF33;
width:10px;
float: right;
}
.z{
border:1px dotted #00CCFF;
width:50px;
top: 12px;
right: -60px;
position: absolute;
position:absolute;
}
ul{
padding:0;
margin:0;
list-style:none;
display:none;
float: right;
}
.kk{
border: thin solid #006699;
width: 250px;
height: 50px;
position: relative;
}
.body{
text-align: center;
}
</style>
<body><div class="kk">
<div class="m" onClick="show()">x</div>
<ul class="z" id="sL">
<li>yyyyyyy</li>
<li>yyyyyyy</li>
<li>yyyyyyy</li>
<li>yyyyyyy</li>
<li>yyyyyyy</li>
</ul>
</div>
<div class="kk"></div>
</body>
<script>
function show()
{
var tag = document.getElementById("sL")
if (tag.style.display=="none")
{
tag.style.display = "block"
}else{
tag.style.display = "none"
}
}
</script>
</html>
...全文


