/    Sign up×
Community /Pin to ProfileBookmark

does anyone know how i can put up 2 clocks?

one will have my time and the other will have their time? there will be other things on this page with it..so i can’t use something called a doc.write thing

emrald

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@rigadonAug 18.2005 — This is a fairly poor clock function I wrote a while ago. I think it will do what you're after though, with a few changes and some optimisation.You could just have two of these functions one for each of your clocks:

[CODE]<SCRIPT LANGUAGE="JavaScript"> <!--
function clock()
{ if (!document.layers && !document.all && !document.getElementById)
{ return;
}

var digital = new Date();

var year = digital.getFullYear();
var mon = digital.getMonth();
var mday = digital.getDate();
var hours = digital.getHours();
var minutes = digital.getMinutes();

var month = new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");

var amOrPm = "AM";
if (hours > 11) amOrPm = "PM";
if (hours > 12) hours = hours - 12;
if (hours == 0) hours = 12;
if (minutes <= 9) minutes = "0" + minutes;

var dispTime = mday + " " + month[mon] + " " + year + " " + hours + ":" + minutes + " " + amOrPm + "&nbsp;";

if (document.layers)
{ document.layers.dispDate.document.write(dispTime);
document.layers.dispDate.document.close();
} else if (document.all)
{ dispDate.innerHTML = dispTime;
} else if (document.getElementById)
{ document.getElementById("dispDate").innerHTML = dispTime;
}

setTimeout("clock()", 10000);
}
//--> </script>

--- and your html ---

<body onLoad="clock()">
<div id="dispDate"></div>[/CODE]

</body>
Copy linkTweet thisAlerts:
@emrald_dragonauthorAug 25.2005 — where in the coding would i put in the date i started my site?
×

Success!

Help @emrald_dragon spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...