本帖最后由 qidizi 于 2010-12-10 10:54:55 编辑

解决方案 »

  1.   

    window.time_s = 1000000;
    setInterval("show_t();",1000);function show_t()
    {
      var c_t= new Date();//++window.time_s去掉
      document.getElementById('time_b').value = '现在时间: '  
      + c_t.getHours() + ':'  
      + c_t.getMinutes() + ':'  
      + c_t.getSeconds() + "|"  
      + c_t.getTime();
      
    }//window.time_s变,gettime也变,但是其它的就不变....无语.用回无参数date正常
      

  2.   

    搞什么?解决方法我是有自己算或是使用重新设置一下毫秒或是秒就可以了.
    但是不明白为什么而已window.time = new Date(<?=$cur_t*1000;?>);//服务器的time()的秒换成毫秒
    setInterval("show_t();",1000);function show_t()
    {
      window.time.setSeconds(window.time.getSeconds()+1);
      document.getElementById('time_b').value = '服务器现在时间: '  + window.time.toLocaleString();  
    }
      

  3.   

    window.time = new Date(<?=$cur_t*1000;?>);//服务器的time()的秒换成毫秒这样即使能获取服务器时间也只能获取一次撒加载时,获取服务器时间setInterval(function(){/** 每秒修改一下服务器时间 */},1000);
      

  4.   

    new Date(time)  // time 是一个时间戳,表示北京时间从1970年1月1日  8:00:00 计起的毫秒数注意:单位是毫秒,所以你需要加满1千次,时间才会跳过1秒
    window.time_s = 1000000;
    setInterval("show_t();",1000);function show_t()
    {
      var c_t= new Date(window.time_s += 1000);
      document.getElementById('time_b').value = '现在时间: '  
      + c_t.getHours() + ':'  
      + c_t.getMinutes() + ':'  
      + c_t.getSeconds() + "|"  
      + c_t.getTime();
    }//window.time_s变,gettime也变,但是其它的就不变....无语.用回无参数date正常