我的页面中有一个tra的时候就没有问题,两个以上就有问题了,请教

解决方案 »

  1.   

    function expandIt(imga,tra){
    var objLst = eval("document.all."+tra);
    if (objLst.length !=null){
    for( var i=0;i<objLst.length;i++){
    exandIt_ex(imga,objLst[i]);
    }
    } else {
    exandIt_ex(imga,objLst);
    }
    }
    function expandIt_ex(imga,obj){
    try {
    if (!obj) return false;
    if (obj.style.display=='block'){
    obj.style.display='none';
    imga.src='../images/tree_expand.gif';
    }
    else if (obj.style.display=='none'){
    obj.style.display='block';
    imga.src='../images/tree_collapse.gif';
    }
    else
    {
    obj.style.display='none';
    imga.src='../images/tree_expand.gif';
    throw "an error ";
    }
    }
    catch(e) { throw e;
    alert(e);
    }
    finally {
    }
    }