//error.js代码
function changepicture( id, cls ) {
    var obj = document.getElementById( id );
    if (obj) {
        if (cls == '1') {
            obj.className = "state1";
            //alert("");
        } else {
            obj.className = "state2";
            //alert("");            
        }
    }
}
function showorhidediv( id ) {
    var obj = document.getElementById( id );
    if (obj) {
        if (obj.style.display == 'block') {
            obj.style.display =  'none';
            changepicture(id.toString().replace('result', 'title'), '1');
        } else {
            obj.style.display = 'block';
            changepicture(id.toString().replace('result', 'title'), '2');
        }
    }    
}//test.css
.state1{padding: 0px 0 0 12px; background:url(../img/show_01.png) no-repeat; background-position: 0 52%;}//+图片
.state2{padding: 0px 0 0 12px; background:url(../img/show_02.png) no-repeat; background-position: 0 52%;}//-图片
//调用test.html
<a href="javascript:void(0);" onFocus="this.blur()" onclick="javascript:showorhidediv('ie_act_result');" >
          <span id="ie_act_title" class="state1">IE Activity Traces</span>
 </a>
上述代码是为了实现:点击<a>元素,切换其背景。
但是,现在没有得到想要的结果.点击+后背景没有切换成-号的背景。但当加上//alert("");  后,-后图片正常切换.
请高手指点下。