日期:2014-05-16  浏览次数:20387 次

只要我的鼠标出现在右边,但还没有放到菜单上面,就弹出子菜单
下面这个菜单的Item1和Item2原来是横着排放的,我把它修改为竖着排放后,出现了奇怪现象,只要我的鼠标出现在右边,但还没有放到菜单上面,就弹出子菜单,请问是什么原因,如何解决?

-------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>javaScriptDropDownMenu</title>
  <style type="text/CSS">
  * {
  padding:0;
  margin:0;
  }
  body {
  font-family:verdana, sans-serif;
  font-size:small;
  }
  #navigation, #navigation li ul {
  list-style-type:none;
  }
  #navigation {
  margin:20px;
  }
  #navigation li {
  text-align:center;
  position:relative;
  }
  #navigation li a:link, #navigation li a:visited {
  display:block;
  text-decoration:none;
  color:#000;
  width:120px;
  height:40px;
  line-height:40px;
  border:1px solid #fff;
  border-width:1px 1px 0 0;
  background:#c5dbf2;
  padding-left:10px;
  }
  #navigation li a:hover {
  color:#fff;
  background:#2687eb;
  }
  #navigation li ul li a:hover {
  color:#fff;
  background:#6b839c;
  }
  #navigation li ul {
  display:none;
  position:absolute;
  top:40px;
  left:0;
  margin-top:1px;
  width:120px;
  }
  #navigation li ul li ul {
  display:none;
  position:absolute;
  top:0px;
  left:130px;
  margin-top:0;
  margin-left:1px;
  width:120px;
  }
  </style>
  <script type="text/Javascript">
  function displaySubMenu(li) {
  var subMenu = li.getElementsByTagName("ul")[0];
  subMenu.style.display = "block";
  }
  function hideSubMenu(li) {
  var subMenu = li.getElementsByTagName("ul")[0];
  subMenu.style.display = "none";
  }
  </script>
</head>
<body>
  <ul id="navigation">
  <li onmouSEOver="displaySubMenu(this)" onmouseout="hideSubMenu(this)">
  <a href="#">Item1</a>
  <ul>
  <li><a href="#">Item1->Menu1</a></li>
  <li><a href="#">Item1->Menu2</a></li>
  <li><a href="#">Item1->Menu3</a></li>
  <li><a href="#">Item1->Menu4</a></li>
  </ul>
</li>
  <li id="tb0" onmouseover="displaySubMenu(this