有没有人来看看呀?代码是这样的:
  <script language="javascript" type="text/javascript">
        var headHeight = 22;var bodyHeight = 202;var objcount = 8;var step = 10;var moving = false;
        function showme(obj1, obj2)//div,td
        {
        if (moving)//                   
        return;
        moving = true;
        for(i=0;i<document.all.tags('td').length;i++)//遍历所有的td
        if (document.all.tags('td')[i].className.indexOf('headtd') == 0)//如果td的class是headtd
        document.all.tags('td')[i].className = 'headtd1';//那么就替换该class为headtd1
        obj2.className = 'headtd2';//将传参td 该为headtd2
        moveme(obj1);//移动div
        }
        function moveme(obj)
        {      
        idnumber = parseInt(obj.id.substr(4));//得到div的标示,item1body 1就是标示
                    //alert(idnumber)
        objtop = headHeight * (idnumber - 1);//离上面的高度为 (标示id-1)*头高
        objbuttom = bodyHeight + headHeight * (idnumber - 2);//离低面得距离为 整个body的高度+头高度*(标示id-2)
        currenttop = parseInt(obj.style.top);//当前离上面的距离为当前对象的样式top
        if (currenttop >= objbuttom)
        {
        countid = 1;
        for(i=0;i<document.all.tags('div').length;i++)
        if (document.all.tags('div')[i].id == 'item'+countid+'body')
        {
        obj = document.all.tags('div')[i];
        objtop = headHeight * (countid - 1);
        if (countid == idnumber)
        {
        moveup(obj,objtop,false);
        break;
        }
        else
        moveup(obj,objtop,true);
        countid++;
        }
        }
        else if ((currenttop >= objtop) && (idnumber < objcount))
        {
        idnumber++;
        countid = objcount;
        for(i=document.all.tags('div').length-1;i>=0;i--)
        if (document.all.tags('div')[i].id == 'item'+countid+'body')
        {
        obj = document.all.tags('div')[i];
        objbuttom = bodyHeight + headHeight * (countid - 2);
        if (countid == idnumber)
        {
        movedown(obj,objbuttom,false);
        break;
        }
        else
        movedown(obj,objbuttom,true);
        countid--;
        }
        }
        }
        function moveup(obj,objtop,ismove)
        {
        currenttop = parseInt(obj.style.top);
        if (currenttop > objtop)
        {
        obj.style.top = currenttop - step;
        setTimeout('moveup('+obj.id+','+objtop+','+ismove+')',1)
        return;
        }
        moving = ismove;
        }
        function movedown(obj,objbuttom,ismove)
        {
        currenttop = parseInt(obj.style.top);
        //alert(currenttop)
        //alert("bbbbbbb")
        if (currenttop < objbuttom)
        {
        obj.style.top = currenttop + step;
        setTimeout('movedown('+obj.id+','+objbuttom+','+ismove+')',1)
        return;
        }
        moving = ismove;
        }
    </script>
在firefox里点它没有反映呀?

解决方案 »

  1.   

    document.all是IE的东西,ff不支持
      

  2.   

    document.all.tags(tagName)换成document.getElementsByTagName(tagName)
      

  3.   

      先说声谢谢呀?
     可是我换成document.getElementsByName(“”)后在IE里也不行了?
      是不是我写错了呀?我把document.all.tags(‘’)全部换成document.getElementsByName(“”)
      

  4.   

      对,对,行了,是没有你那个属性?getElementsByTagName
     谢谢呀?
     如何给你分呀?
      

  5.   

       还有个问题?
        代码如下: 
        function  Year_Month(){  
                        var  now  =  new  Date();  
                        var  yy  =  now.getYear();  
                        var  mm  =  now.getMonth();  
                var  mmm=new  Array(); 
              mmm[0]="1"; 
              mmm[1]="2"; 
                mmm[2]="3"; 
                mmm[3]="4"; 
                mmm[4]="5"; 
                mmm[5]="6"; 
                mmm[6]="7"; 
                mmm[7]="8"; 
                mmm[8]="9"; 
                mmm[9]="10"; 
              mmm[10]="11"; 
                mmm[11]="12"; 
                mmm=mmm[mm]; 
                        return(mm);  } 
                function  thisYear(){  
                        var  now  =  new  Date();  
                        var  yy  =  now.getFullYear();  
                        return(yy  );  } 
                  function  Date_of_Today(){  
                        var  now  =  new  Date();  
                        return(now.getDate()  );  } 
                  function  CurentTime(){  
                        var  now  =  new  Date();  
                        var  hh  =  now.getHours();  
                        var  mm  =  now.getMinutes();  
                        var  ss  =  now.getTime()  %  60000;  
                      ss  =  (ss  -  (ss  %  1000))  /  1000;  
                        var  clock  =  hh+':';  
                        if  (mm  <  10)  clock  +=  '0';  
                        clock  +=  mm;  
                        return(clock);  }  
                function  refreshCalendarClock(){  
                document.all.calendarClock1.innerHTML  =  Year_Month();  
                document.all.calendarClock2.innerHTML  =  Date_of_Today();  
                document.all.calendarClock3.innerHTML  =thisYear();  
                document.all.calendarClock4.innerHTML  =  CurentTime();  } 
                document.write(' <div style="left:100px;  bottom: 4px; position: absolute; text-align: center; z-index: 109" ForeColor="#ffffff">') 
                document.write(' <span style="color: #ffffff; font-family: 楷体;font-size:10px">') 
                document.write(' <font  id="calendarClock1" color="#ffffff" > </font>/'); 
                document.write(' <font  id="calendarClock2" color="#ffffff">  </font>/'); 
                document.write(' <font  id="calendarClock3" color="#ffffff">  </font>&nbsp;'); 
                document.write(' <font  id="calendarClock4" color="#ffffff">  </font>'); 
                document.write(' </span>') 
                document.write(' </div>') 
                setInterval('refreshCalendarClock()',1000); 
                setInterval('callServer() ',1000); 
       同样在IE里行,在firefox里不行?
       我换成document.getElementById()也不行?
      谢谢呀?
      

  6.   

    试试把document.all.calendarClock1.innerHTML  =  Year_Month(); 换成document.getElementById('calendarClock1').innerHTML = Year_Month();另:建议不要用<font>标签,改用<span>
      

  7.   

    全是document.all惹得祸!!!
    document.all是IE专用!!!
      

  8.   

     谢谢你们呀?
      但是我换成<span>,document.getElementById('calendarClock1').innerHTML = Year_Month(); 还是不行,看来是没法了?