代码差不多如下所示,就是通过点击area热区,改变下面td的背景图片,试了很久都没有写出来,求助ing
<td id="changebg" style="background-image:url(images/b1.png)" width="469" height="41" >
              
              <img src="images/10.png" border="0" width="469" height="30" usemap="#choice"/>
              <map name="choice">
                <area shape="rect" coords="14,11,62,42" href="1.html" target="frame" onclick=""/>
                <area shape="rect" coords="64,11,125,41"  href="2.html" target="frame" onclick=""/>
                <area shape="rect" coords="126,11,186,42"  href="1.html" target="frame" onclick=""/>   
                <area shape="rect" coords="190,11,275,41" href="4.html" target="frame" onclick=""/>
                
              </map>
            </td>

解决方案 »

  1.   

    LZ这样写不行吗?    function ChangeTdBg() {
            document.getElementById("changebg").style.backgroundImage = "b2.png";
        }
      

  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>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>test</title>
    </head>
    <body>
    <table border="1">
    <tr>
    <td id="changebg" style="background-image:url(http://www.google.com.hk/intl/zh-CN/images/logo_cn.png)" width="469" height="141" >  
      <img src="http://tx.bdimg.com/sys/portrait/item/2c956261696475636f727073706163652b01.jpg" border="0" width="469" height="30" usemap="#choice"/>
      <map name="choice">
        <area shape="rect" coords="14,11,62,42" href="1.html" target="frame" onclick="fun()"/>
        <area shape="rect" coords="64,11,125,41"  href="2.html" target="frame" onclick="fun()"/>
        <area shape="rect" coords="126,11,186,42"  href="1.html" target="frame" onclick="fun()"/>   
        <area shape="rect" coords="190,11,275,41" href="4.html" target="frame" onclick="fun()"/>     
      </map>
    </td>
    </tr>
    </table><script type="text/javascript">
    function fun(){
    document.getElementById("changebg").style.backgroundImage = "url(http://www.baidu.com/img/baidu_logo.gif)";
    }
    </script>
    </body>
    </html>