bobrivers2003
Technical User
I have been working on a world clock that use a gif of the world that has the major cities on the map set up as a clickable link that displays the time for that city. Default time is UK that shows when the page is first loaded. With my current set up when a city is clicked the time changes for that city only for a split second then changes back the uk time (which continues to count). Is there a way to have the time for a selected city stay up until another city is clicked?
Two files ->
worldClock.html:
snippet of city link = <AREA SHAPE="RECT" COORDS="5,97,62,118" HREF="Javascript:" OnClick="upclock(-8,'EST','Los Angelas'); return false;">
At the bottom of this file;
<!--
Script to start the clock
-->
<script>
setInterval("upclock('', '', '')",1000);
</script>
<DIV id="clockWT" style="display: block;" </DIV>
time.js:
function upclock(timeset, type, place){
var diff = timeset;
var city = place;
var timeType = type;
var dtUK = new Date();
var dtWT = new Date(dtUK.getTime()+ diff*60*60*1000);
var hrs1 = dtWT.getHours();
var min1 = dtWT.getMinutes();
var sec1 = dtWT.getSeconds();
var col = ":";
var spc = " ";
if (hrs1<=9) hrs1="0"+hrs1;
if (min1<=9) min1="0"+min1;
if (sec1<=9) sec1="0"+sec1;
clockWT.innerHTML = hrs1+col+min1+col+sec1;
}
Any help or pointers would be greatly appreciated
Two files ->
worldClock.html:
snippet of city link = <AREA SHAPE="RECT" COORDS="5,97,62,118" HREF="Javascript:" OnClick="upclock(-8,'EST','Los Angelas'); return false;">
At the bottom of this file;
<!--
Script to start the clock
-->
<script>
setInterval("upclock('', '', '')",1000);
</script>
<DIV id="clockWT" style="display: block;" </DIV>
time.js:
function upclock(timeset, type, place){
var diff = timeset;
var city = place;
var timeType = type;
var dtUK = new Date();
var dtWT = new Date(dtUK.getTime()+ diff*60*60*1000);
var hrs1 = dtWT.getHours();
var min1 = dtWT.getMinutes();
var sec1 = dtWT.getSeconds();
var col = ":";
var spc = " ";
if (hrs1<=9) hrs1="0"+hrs1;
if (min1<=9) min1="0"+min1;
if (sec1<=9) sec1="0"+sec1;
clockWT.innerHTML = hrs1+col+min1+col+sec1;
}
Any help or pointers would be greatly appreciated