<table width="165" border="0" cellspacing="0"  cellpadding="0" style="background:url(../Image/mexu.jpg) no-repeat;">
<tr> 
  <td height="35" align="center"><%=LinkName%></td>
</tr>
  </table>
如何在这个表格上加上 onmouseover 和  onmouseout 事件变换图片?

解决方案 »

  1.   

    <table width="165" border="0" cellspacing="0"  cellpadding="0" style="background:url(image/baby.jpg);" onmouseover="this.style.backgroundImage='url(http://img.baidu.com/img/logo-zhidao.gif)'" onmouseout="this.style.backgroundImage='url(image/collapse.jpg)'">
      

  2.   


    <!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 runat="server">
        <title>test</title>
        <script type="text/javascript" language="javascript">
            function fn1() {
                var obj = document.getElementById("table1");
                if (obj != null) {
                    obj.style.background = "url(image/me2.JPG) no-repeat";
                }
            }
            function fn2() {
                var obj = document.getElementById("table1");
                if (obj != null) {
                    obj.style.background = "url(image/me1.gif) no-repeat";
                }
            }
        </script>
    </head>
    <body>
        <table width="165" border="0" cellpadding="0" cellspacing="0" style="background:url(image/me1.gif) no-repeat;" onmouseout="fn1()" onmouseover="fn2()" id="table1"><tr><td height="35" align="center"> conent </td></tr></table>
    </body>
    </html>