在开始初始化一个时间对象,然后在onload事件中在用当前时间减去那个时间就可以了

解决方案 »

  1.   

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    <script language="javascript">
    var stratSeconds="";
    var endSeconds="";
    function onLoadTime(){
    Date nowDate=new Date();

    stratSeconds=nowDate.getSeconds();
    }

    function onEndTime(){
    Date nowDate=new Date();

    endSeconds=nowDate.getSeconds();
    }

    function showTimeDif(){
    //要得  差的表格  由于HTML是顺须  编译如在前面写的话  找不到下面的函数

    //id名  表格
    obj.innerText=stratSeconds+endSeconds+"秒";
    }
    </script>
    </head><body onload="onLoadTime()">
    </body>
    <script>
    onEndTime();
    showTimeDif();
    </script>
    </html>
      

  2.   

    首先在一个网页的开头定义一个变量:dim startimestartime=timer()在显示页面执行时间的地方,这个地方应该是页尾的地方:dim endtimeendtime=timer()页面执行时间:<%=formatnumber((endtime-startime)*1000,3)%>毫秒
      

  3.   

    开始:
    <script>
    var now1 =new Date()
    StarTime_S=now1.getTime()
    </script>
    结束:
    <script> 
    var now1 =new Date()
    EndTime_S=now1.getTime()
    document.write ((EndTime_S-StarTime_S)+"ms");
    </script>
      

  4.   

    什么是页面执行时间?如果页面中包含一个link,而拿这个link花了很长时间,这个时间算不算?