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

新老版本问题,html属性的不同写法,css控制,在js中的调用
HTML code
  
        <td id="imgmenu0" background="image/menuup.jpg" style="height:25px; cursor:hand;" onclick="showmenu(0)">&nbsp;&nbsp;<span>系统维护</span>
        </td>

   //相应js代码:(以前的写法是对的)
   ……
   imgmenu0.background="image/menudown.gif";
    

如果改成css样式的写法,相应的js怎么写啊
HTML code
<td style="height:25px;background-image:url("image/menuup.gif")</td>

//我写的相应js代码不对啊
……
imgmenu0.background-image=url("image/menudown.gif");




各位老大,虽说以前过时的属性写法也不报错,只是提示一下,感觉就是不爽啊!

问题:
  1。我上面换背景的js要怎么写
  2。各位现在都要css控制页面吗?


------解决方案--------------------
帮顶
------解决方案--------------------
HTML code

<style type="text/css">
    #td {
        background: image/menuup.jpg;
        height:25px; 
                cursor:hand
    }
</style>

<td id="imgmenu0" class="tdclass" onclick="showmenu(0)">

------解决方案--------------------
C# code

    <table>
        <tr>
        <td id="imgmenu0" style="background-image:url('img/logo.png');height:200px;width:400px">a</td>            
        </tr>
    </table>
    <script type="text/javascript">
    imgmenu0.style.backgroundImage = 'url("img/login_bg.jpg")';    
    </script>