Forums Index > Mewsoft Products > Auctionawy > Javascript liveclock
totalbids First Post Posted on: 02-28-08 11:30 PM
Javascript liveclock

Hello all.

I have finally managed to get a live clock running on my site. You can view it at www.totalbids.co.uk

If anyone would like this option then please email me at admin@totalbids.co.uk and i will send you the file and the instructions on how to do this.

This basically replaces the static clock on the welcome area on every page.

Cheers

Jason
Marty Reply #: 1 Posted on: 03-02-08 01:49 AM
Re: Javascript liveclock

I was wondering if you could post your java clock script here ?

I have a similar clock on my own site, but the problem is my clock gets the time from my PC not my server thus, when viewing an Item "ViewItem" You get two different times.

My point is that iam trying to apply a live clock to the ViewItem pages but I cant get the 2 (same) scripts running on the same page etc..
Marty Reply #: 2 Posted on: 03-02-08 03:32 AM
Re: Javascript liveclock

Theres probably an easier way but heres what I did......

BTW do this at your own risk 8) Mewsoft are not responsible for any loss or damaged data.

Open your admin panel enter into..........

General Classes :

Open......

Welcome_Area

Find this <!--CLASS:big grinate_Time:11--> and delete it. Replace it with the follow code......

<script>
var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December")

function getthedate(){
var mydate=new Date()
var year=mydate.getYear()
if (year < 1000)
year+=1900
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
if (daym<10)
daym="0"+daym
var hours=mydate.getHours()
var minutes=mydate.getMinutes()
var seconds=mydate.getSeconds()
var dn="AM"
if (hours>=12)
dn="PM"
if (hours>12){
hours=hours-12
}
if (hours==0)
hours=12
if (minutes<=9)
minutes="0"+minutes
if (seconds<=9)
seconds="0"+seconds
var cdate="<large><font color='F0F8FF' face='TAHOMA, ARIAL, TIMES'><b>"+dayarray[day]+", "+montharray[month]+" "+daym+", "+year+" "+hours+":"+minutes+":"+seconds+" "+dn
+"</b></font></small>"
if (document.all)
document.all.clock.innerHTML=cdate
else if (document.getElementById)
document.getElementById("clock").innerHTML=cdate
else
document.write(cdate)
}
if (!document.all&&!document.getElementById)
getthedate()
function goforit(){
if (document.all||document.getElementById)
setInterval("getthedate()",1000)
}

</script>
<span id="clock"></span>



Last bit, Copy/Paste this <body onLoad="goforit()"> anywhere after that.