日期:2014-05-18  浏览次数:20475 次

请问JS如何改变<td>的背景图片??附代码!
function menuChange(obj,menu)
{
debugger
if(menu.style.display=="")
{
obj.background="../images/admin_title_bg_show.gif"; menu.style.display="none";
}else{
obj.background="../images/admin_title_bg_quit.gif"; menu.style.display="";
}
}
<table cellSpacing="0" cellPadding="0" align="center" style="width: 177px">
<tr style="CURSOR: hand">
<td class="menu_title" id="a" style="background:url('../Images/admin_title_bg_show.gif'); width: 154px; height: 25px;" onmouseover="this.className='menu_title2';" onmouseout="this.className='menu_title';" onclick="menuChange(this,menu1);">
<span><font color="white">门户管理</font></span>
</td>
</tr>
<tr>
<td style="width: 154px">
<div class="sec_menu" id="menu1" style="WIDTH: 169px; background-color:#0957DA;">
<table cellSpacing="0" cellPadding="0" width="140" align="center" border="0">

<tr>
<td style="height: 20px" ><A href="../NTDH_MH/Back/ListDoor.aspx?SetID=1" target="main">通知公告</A></td>
</tr>
<tr>
<td style="height: 20px" ><A href="../NTDH_MH/Back/ListDoor.aspx?SetID=2" target="main">新闻中心</A></td>
</tr>
<tr>
<td style="height: 20px" ><A href="../NTDH_MH/Back/ListDoor.aspx?SetID=3" target="main">知识库</A></td>
</tr>
<tr>
<td style="height: 20px" ><A href="../NTDH_MH/Back/ListDoor.aspx?SetID=4" target="main">企业招聘</A></td>
</tr>
<tr>
<td style="height: 20px" ><A href="../NTDH_MH/Back/ListDoor.aspx?SetID=5" target="main">知名客户</A></td>
</tr>
</table>
</div>
</td>
</tr>
</table>

点击之后图片没变啊!!请问改如何改呢??

------解决方案--------------------
obj.style.backgroundImage= "url(../images/admin_title_bg_show.gif)";