A period of time before the company to do a commercial website, you need such a piece of code. Later I help a friend to do a navigation website, also need such a piece of code. Today to help those who need friends, the format is: April 1, 2010 Thursday 22:12:03, if necessary, direct copy, can also add their own changes. Tested, compatible with IE6, IE8, Firefox version 3.6.2.
JavaScript code:
<script type= "Text/javascript"
Function Timeprint ()
{
var week; var date;
Var tod Ay=new Date ()
var year=today.getfullyear ()
var month=today.getmonth () +1
var day=today.getdate ()
Var ss= Today.getday ()
var hours=today.gethours ()
var minutes=today.getminutes ()
var seconds=today.getseconds ()
date=year+ "Year" +month+ "month" +day+ "Day"
if (ss==0) week= "Sunday"
if (ss==1) week= "Monday"
if (ss==2) week= "Tuesday"
If (ss==3) week= "Wednesday"
if (ss==4) week= "Thursday"
if (ss==5) week= "Friday"
if (ss==6) week= "Saturday"
if (minutes<=9)
minutes= "0" +minutes
if (seconds<=9)
seconds= "0" +seconds
myclock=date+week+ "+hours+": "+minutes+ ': ' +seconds
if (document.layers) {document.layers.liveclock.document.write (Myclock)
Document.layers.liveclock.document.close ()
}else
document.getElementById (' Liveclock '). Innerhtml=myclock
settimeout ("Timeprint ()", 1000)
}
Timeprint ()
</script>
Place the HTML code where you want the time to appear:
<span id= "Liveclock" ></span>
Can be achieved, the effect of screenshots: