function showtime(){

var Digital=new Date()
document.text1.value=Digital
setTimeout("showtime()",1000)
}

解决方案 »

  1.   

    timer控件用在winform里比较好吧
      

  2.   

    //***********显示时间*****************
    function clock()
      {
    crtdate=new Date();
    crthours=crtdate.getHours();
    crtminutes=crtdate.getMinutes();
    crtSeconds=crtdate.getSeconds();
    if (crthours >= 7 && crthours < 12)
      apm="上午";
    else if (crthours >= 12 && crthours < 19)
      apm="下午";
    else
      apm="晚上";
    if (crthours >12 )
      crthours=crthours % 12;
    if (crtminutes < 10)
      crtminutes="0"+crtminutes;
    if (crtSeconds < 10)
    crtSeconds="0" + crtSeconds;
     if(crtdate.getDay()==0) day = "星期日"
     if(crtdate.getDay()==1) day = "星期一"
     if(crtdate.getDay()==2) day = "星期二"
     if(crtdate.getDay()==3) day = "星期三"
     if(crtdate.getDay()==4) day = "星期四"
     if(crtdate.getDay()==5) day = "星期五"
     if(crtdate.getDay()==6) day = "星期六"
    viewtime= day + " " + apm + " " + crthours + " 点 " + crtminutes + " 分 " + crtSeconds + " 秒 " ;
    esh.innerText=viewtime;
    setTimeout("clock()",1000);
    };///调用
    <span id=esh></span>