var now = new Date(); //Declares a variable called now. This is a date number using the built in function Date()
var hours = now.getHours(); //Use the built in method getHours to set the hour variable to the hour number from now
var minutes = now.getMinutes(); //Use the built in method getMinutes to set the minute variable to the hour number from now

var dayname = new Array ("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"); //declares an array called dayname - this array has 7 elements
var monthname = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"); //declares and array called monthname
hours += (((minutes < 10) ? ":0" : ":") + minutes) //Assembles the hour and minute value into one lump. Inserts a leading 0 if the minute value is less than 10

var thisday
mydate = new Date()
myday = mydate.getDay()
mymonth = mydate.getMonth()
myweekday= mydate.getDate()
var myyear= mydate.getYear()
thisday = dayname[myday] //sets thisday to the value of the element in the dayname array accessed by the myday value. Thus if myday is 0 thisday is element 0 in the array (Sunday). JavaScript uses zero based arrays so the first element is at position zero.
if (myyear<1900)
myyear=myyear+1900 //Navigator reads the year number (getYear) from 1900 so this adds 1900 if myyear is less than 1900. As IE reads getYear differently it jumps this bit 

if(myweekday==1) //I couldn't get the nested If statement to work using a logical Or so I've written every bit separately for now. 
var text ="st"
else if (myweekday==31)
var text ="st"
else if (myweekday==21)
var text ="st"
else if(myweekday==2)
var text ="nd"
else if(myweekday==22)
var text ="nd"
else if(myweekday==3)
var text ="rd"
else if (myweekday==23)
var text ="rd"
else
var text="th"
//The next part writes the stuff out to the HTML page. You'll see that tags are written as well as the variable values but double quotes are not used within the HTML tags (as these are the text delimiters for JavaScript so it would all get confused).
document.write("<P ALIGN=center><FONT FACE=VERDANA,ARIAL title=Clock><img src=resources/10.gif width=100% height=2><b>"  + hours + " - " + thisday +", "+ monthname[mymonth]+" "); document.write(myweekday +""+ text + ", "+ myyear + "</B><img src=resources/10.gif width=100% height=2>");