<script>
    function change_btn_bgimg(oButton)
    {
      oButton.style.backgroundImage="imageurl";
    }
</script><!-- <body>和</body>之间的一个按钮 -->
<input class="btn_submit" type="submit" onmouseover="change_btn_bgimg(this);" name="Submit_2" value="修&nbsp;改">

解决方案 »

  1.   

    按照楼上说的,imageurl 用如下形式:
    function change_btn_bgimg(oButton)
    {
         oButton.style.backgroundImage="url(button_02.gif)";
    }
      

  2.   

    <stype>
    .btn_submit {
          height: 19px;
          width: 60px;
          background-image: url( button_01.gif );
                }
    .btn_submit2 {
          height: 19px;
          width: 60px;
          background-image: url( button_02.gif );
                }
    </style>
    ...
    for(var i=0;i<document.all.length;i++)
    if (document.all[i].class==btn_submit1)
    obj.class=btn_submit2;
    ...document对象不知道能不能这么用,不过大概意思就是这个了多写一个类,替换对象的类
      

  3.   

    function change_btn_bgimg()
    {
    for(i = 0; i < document.all.length; i++){
    if(document.all(i).tagName.toUpperCase()=="STYLE")
    {
       alert(document.all(i).innerHTML);
    }
    }
    }
    这个可以得到<style>中的内容,但偶不清楚怎么得到具体一个css样式
    后来想到用找到,替换的办法把.btn_submit{}中的内容替换,但又好像style的innerHTML不能修改.没招了,,如果只是想换某个元素的背景的话,那可以按楼上几位的去做:
    1.得到某元素,然后指定obj.style.backgroundImage
    2.楼上说的替换元素的class
      

  4.   

    <input class="btn_submit" type="submit" onmouseover="this.style.backgroundImage='url(button_02.gif)';"