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

javascript 缺少对象 请求高手帮助
<html>
<head>
  <title>鼠标离入离出切换图片</title>
  <script type="text/javascript">
  function MouseIn(imgUrl) {
  document.getElementById("MyImg").src = imgUrl;
  }
  function MouseOut(imgUrl) {
  document.getElementById("MyImg").src = imgUrl;
  }
  </script>
</head>
<body>
  <form id="form1" runat="server">
  <div>
  <img alt="" id="MyImg" src="Images/1.jpg" width="200px;" height="200px;" onmouseover="MouserIn('Images/2.jpg')" onmouseout="MouserOut('Images/1.jpg')"/>
  </div>
  </form>
</body>
</html>

//本人是当学javascript,所以不太懂,请各位高手帮忙解答,不知道这个哪里错了

------解决方案--------------------
JScript code

function MouseIn(imgUrl) {
  document.getElementById("MyImg").src = imgUrl;
  }
  function MouseOut(imgUrl) {
  document.getElementById("MyImg").src = imgUrl;
  }

------解决方案--------------------
你js中定义的函数名是MouseIn和MouseOut
而你在html中调用的是MouserIn和MouserOut