<script language="VBScript">
function display1(num)
  dim imagename
  dim name
  dim total
  if(num<10) then
  if document.all("subtree"+chr(48+num)).style.display="none"  then
                          document.all("subtree"+chr(48+num)).style.display=""
  document.all("image"+chr(48+num)).src="image/t_sub.gif"
  document.all("img"+chr(48+num)).src="image/open.gif"
  else
 document.all("subtree"+chr(48+num)).style.display="none"
 document.all("image"+chr(48+num)).src="image/t_plus.gif"
 document.all("img"+chr(48+num)).src="image/close(1).gif"
   end if  
  end if
  if(num>9) then
  if document.all("subtree"+chr(49)+chr(48+num-10)).style.display="none"  then
                          document.all("subtree"+chr(49)+chr(48+num-10)).style.display=""
  document.all("image"+chr(49)+chr(48+num-10)).src="image/t_sub.gif"
  document.all("img"+chr(49)+chr(48+num-10)).src="image/open.gif"
  else
 document.all("subtree"+chr(49)+chr(48+num-10)).style.display="none"
 document.all("image"+chr(49)+chr(48+num-10)).src="image/t_plus.gif"
 document.all("img"+chr(49)+chr(48+num-10)).src="image/close(1).gif"
   end if  
  end if
  end function
</script>

解决方案 »

  1.   

    try<script>
    function display1(num){
    var imagename
    var name
    var total
    if(num<10){
    if(document.all("subtree"+String.fromCharCode(48+num)).style.display=="none"){
    document.all("subtree"+String.fromCharCode(48+num)).style.display=""
    document.all("image"+String.fromCharCode(48+num)).src="image/t_sub.gif"
    document.all("img"+String.fromCharCode(48+num)).src="image/open.gif"
    }else{
    document.all("subtree"+String.fromCharCode(48+num)).style.display="none"
    document.all("image"+String.fromCharCode(48+num)).src="image/t_plus.gif"
    document.all("img"+String.fromCharCode(48+num)).src="image/close(1).gif"
    }
    }
    if(num>9){
    if(document.all("subtree"+String.fromCharCode(49)+String.fromCharCode(48+num-10)).style.display=="none"){
    document.all("subtree"+String.fromCharCode(49)+String.fromCharCode(48+num-10)).style.display=""
    document.all("image"+String.fromCharCode(49)+String.fromCharCode(48+num-10)).src="image/t_sub.gif"
    document.all("img"+String.fromCharCode(49)+String.fromCharCode(48+num-10)).src="image/open.gif"
    }else{
    document.all("subtree"+String.fromCharCode(49)+String.fromCharCode(48+num-10)).style.display="none"
    document.all("image"+String.fromCharCode(49)+String.fromCharCode(48+num-10)).src="image/t_plus.gif"
    document.all("img"+String.fromCharCode(49)+String.fromCharCode(48+num-10)).src="image/close(1).gif"
    }
    }
    }
    </script>
      

  2.   

    就一个if语句的转换,还有Chr(charcode)换成String.fromCharCode(49),很简单啊,自己解决吧