It uses the idea of recursive calling!
Function settime ()
{
VaR myyear, mymonth, myweek, myday, mytime, mymin, myhour, mysec;
VaR mydate = new date ();
Myyear = mydate. getfullyear ();
Mymonth = mydate. getmonth ();
Myday = mydate. getdate ();
Myhour = mydate. gethours ();
Mymin = mydate. getminutes ();
Mysec = mydate. getseconds ();
Mytime = "today is:" + myyear + "year" + mymonth + "month" + myday + "day" + myhour + ":" + mymin + ":" + mysec;
Document. getelementbyid ('xwgtime'). innerhtml = mytime;
SetTimeout ('settime () ', 1000 );
}
This will display the time! The script is really powerful ...! This method can also be used to convert the website to another page when the website is too few!
For example:
Function settime (nometime)
{
Document. getelementbyid ("timevalue"). innerhtml = nometime + "automatically log on after seconds ";
Nometime --;
If (nometime =-1)
{
Document. getelementbyid ("timevalue"). style. Display = "NONE ";
Return;
}
Window. setTimeout ("javascript: settime (" + nometime + ")", 1000 );
}
Nometime is the initial time, for example, 10 seconds!