Copy codeThe Code is as follows:
<Html>
<Head>
<Script type = "text/javascript">
Function startTime ()
{
Var today = new Date ()
Var h = today. getHours ()
Var m = today. getMinutes ()
Var s = today. getSeconds ()
// Add a zero in front of numbers <10
M = checkTime (m)
S = checkTime (s)
Document. getElementById ('txt '). innerHTML = h + ":" + m + ":" + s
T = setTimeout ('starttime () ', 500)
}
Function checkTime (I)
{
If (I <10)
{I = "0" + I}
Return I
}
</Script>
</Head>
<Body onload = "startTime ()">
<Div id = "txt"> </div>
</Body>
</Html>
Copy codeThe Code is as follows:
<Script type = "text/javascript">
Var d = new Date ()
Var weekday = new Array (7)
Weekday [0] = "Sunday"
Weekday [1] = "Monday"
Weekday [2] = "Tuesday"
Weekday [3] = "weekday"
Weekday [4] = "Thursday"
Weekday [5] = "Friday"
Weekday [6] = "Saturday"
Document. write ("today is" + weekday [d. getDay ()])
</Script>