日期:2014-05-16 浏览次数:20534 次
<div id="demo" style="width:100px;height:100px;border:1px solid blue;background:red;">
      sssssssssssssss
        <div id="inner">test hello</div>
</div>
<script>
   document.getElementById('demo').onmouseover=function(){
          document.getElementById('inner').style.color='white';
   }
   document.getElementById('demo').onmouseout=function(){
          document.getElementById('inner').style.color='';
   }
</script>
------解决方案--------------------
document.getElementById('inner').style.color='white';这行下面加上:
     this.style.background='url(image/01.jpg)';  //确保路径正确。
鼠标移开换回原来背景。
  this.style.background='red';
------解决方案--------------------
我用jquery实现的  你可以看看啊  
<!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>
   <title></title>
   <script src="js/jquery-1.4.1-vsdoc.js" type="text/javascript"></script>
   <script type="text/javascript">
       $(function() {
           $("#demo").mouseover(function() {
               $("#inner").css("background-color", "white");
           });
           $("#demo").mouseout(function() {
               $("#inner").css("background-color", "");
           });
       }) 
       
   </script>
</head>
<body>
  <div id="demo" style="width:100px;height:100px;border:1px solid blue;background:red;">
     sssssssssssssss
       <div id="inner">test hello</div>
</div>
</body>
</html>
希望对你有所帮助。