Control Panel/Webmail Log in
|
Search
|
|
|
|
|
| |
| |
|
|
Add
a clock to your website
This page will allow you to add a little clock
to your site. Rule number one: You do not need to know anything
about JavaScript to do this. You're just going to cut stuff,
and paste it into the HTML of your web site. The results look like:
The first part you're going to need is the script
that is hidden from view that does all the thinking. Then there
are two parts that show the results.
Part I: The Script
Yes, all that stuff in the box below is giberish.
The question is, is giberish a word? Anyway, the important thing
is that you don't have to think about it or know what it means.
What you have to be able to do, is cut it and paste it into your
HTML. Do that and you're done with part one.
Cut and paste the script below into your HTML |
|
<script
language="JavaScript" type="text/JavaScript">
function initArray() {
for(i=0;i<initArray.arguments.length; i++)
this[i] = initArray.arguments[i];
}
var isnMonths=new initArray("JANUARY","FEBRUARY","MARCH",
"APRIL","MAY","JUNE",
"JULY","AUGUST","SEPTEMBER",
"OCTOBER","NOVEMBER","DECEMBER");
var isnDays= new initArray("Sun","Mon","Tue","Wed",
"Thu","Fri","Sat","Sun");
today=new Date();
hrs=today.getHours();
min=today.getMinutes();
sec=today.getSeconds();
clckh=""+((hrs>12)?hrs-12:hrs);
clckm=((min<10)?"0":"")+min;
clck=(hrs>=12)?"PM":"AM";
var
stnr="";
var ns="0123456789";
var a="";
function
getFullYear(d) { // d is a date object
yr = d.getYear();
if (yr < 1000)
yr+=1900;
return yr;
}
</script> |
Part II: The Calls
The next two parts are, the date ()
and the time (
EST). Again, don't think about it, just paste either or both some
time after the first part and you're done.
Date
Script - |
|
<script>document.write("
"+isnDays[today.getDay()]+", "+isnMonths[today.getMonth()]+"
"+today.getDate()+", "+getFullYear(today)+"");</script>
|
Clock
Script -
|
|
<script>document.write("
"+clckh+":"+clckm+" "+clck+"
");</script>
|
You can adjust the local time by adding text that
adds or subtracts hours like. For example, to subtract two hours
just change "+clckh+" to "+clckh
- 2+" in the above example. Now,
become
!
|