不是很明白你的需求。要是能说清楚一点就好了。

解决方案 »

  1.   

    给你个例子:
    <HTML style="width:480px;height:400px;">
    <HEAD>
    <TITLE> Template </TITLE>
    <META http-equiv=Pragma content='No-Cache'>
    <META content="text/html; charset=GB2312" http-equiv=Content-Type>
    <META http-equiv='Cache-Control' content='no-cache,must-revalidate'>
    <META http-equiv='Cache-Control' content='no-store'>
    <META http-equiv='expires' content='0'>
    <script>
    var Year=new Date().getYear();
    var Month=new Date().getMonth()+1;
    var stayTime=new Date();
    window.onload=function()
    {
    stayTime.setHours(0,0,0)
    setTimeout('showTime()',1000) ;
    }function showTime()
    {
    var d=new Date();
    var hour= d.getHours();
    var min= d.getMinutes();
    var sec= d.getSeconds();
    if (hour<10) hour="0"+hour;
    if (sec<10) sec="0"+sec;
    if (min<10) min="0"+min;
    currentDate=Year+"年"+Month+"月"+ d.getDate()+"日"+ "  "+hour+":"+min+":"+sec+'<br/>'
    var sec1=stayTime.getSeconds()+1
    stayTime.setSeconds(sec1);
    hour=stayTime.getHours();
    min= stayTime.getMinutes();
    sec= stayTime.getSeconds();
    if (sec<10) sec="0"+sec;
    if (min<10) min="0"+min;
    if (hour<10) hour="0"+hour;
    currentDate=currentDate+"连接时间:"+hour+":"+min+":"+sec
    div1.innerHTML=currentDate;
    setTimeout('showTime()',1000) ;
    }
    </script>
    </HEAD><BODY>
    <div id='div1'></div>
    </BODY>
    </HTML>