<td background="bg4.gif"><a href="test.jsp" target="_blank" onclick="this.parentNode.background='bg2.gif'">changegif</a></td>

解决方案 »

  1.   

    可以实现,但前提是你的超链接不能这样用,应该这样用:<a href="javascript:ChangeImage()" style="cursor:pointer;">XXXXX</a>,这样你就可以用脚本动态改变背景图了。
      

  2.   

    谢谢,我要改变的<TD>是不确定的呢?该怎么解决?能否给个通用的函数啊?
      

  3.   

    <table border=1 width=100 height=80>
    <tr>
    <td background="http://community.csdn.net/images/CSDN_logo.GIF" onclick="this.style.backgroundImage='url(http://community.csdn.net/images/jspd_wdzx_sqgg_ad.gif)'">dsadasdasdasdas</td>
    </tr>
    </table>
      

  4.   

    <script language=javascript>
    function ch_bg(obj_in_cell,new_picture)
    {
        obj_in_cell.parentNode.background=new_picture;
    }
    </script><table border=1><tr>
    <td background="bg4.gif"><a href="test.jsp" target="_blank" onclick="ch_bg(this,'bg2.gif')">changegif</a></td>
    </tr></table>