so please take into account I am a newbie. I currently use the following script throughout my pages to display the time:
var currenttime = '<? print date("F d, Y H:i:s", time())?>' //PHP method of getting server date
var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December")
var serverdate=new Date(currenttime)
function padlength(what){
var output=(what.toString().length==1)? "0"+what : what
return output
}
function displaytime(){
serverdate.setSeconds(serverdate.getSeconds()+1)
var datestring=montharray[serverdate.getMonth()]+" "+padlength(serverdate.getDate())+", "+serverdate.getFullYear()
var timestring=padlength(serverdate.getHours())+":"+padlength(serverdate.getMinutes())+":"+padlength(serverdate.getSeconds())
document.getElementById("servertime").innerHTML=datestring+" "+timestring
}
window.onload=function(){
setInterval("displaytime()", 1000)
}
and display it with the following html:
<div id="header"><span class="time" id="servertime"></span></div>
what I assumed I could do, rather than having the same script in <head> of every page, put the script in an external .js file and include it using:
<script type="text/javascript" src="live_clock.js"></script>
now my root is .../ece70141/
I have just put it in the same directory (.js file as the others) just to get it to work. However its not working. Could somebody please advise me how to do this properly?
many thanks,