1
   

Digital clock of two or more countries on same page

 
 
Reply Mon 8 Aug, 2005 05:42 am
Hi,

I am trying to make didgital clock of more than one country but not able to make.

The code I am using is below:

<head>
<script language="javascript">
function GMTClock()
{
if (!document.layers && !document.all)

return;
var Time = new Date();
var gmtMS = Time.getTime() + (Time.getTimezoneOffset() * 60000)
var gmtTimeIndia =new Date(gmtMS+ 5*60*60000+30*60000)
var hoursIndia = gmtTimeIndia.getHours();
var minutesIndia = gmtTimeIndia.getMinutes();
var secondsIndia = gmtTimeIndia.getSeconds();
var dn = "AM";

if (hoursIndia >= 12)
{
dn = "PM";
hoursIndia = hoursIndia - 12;
}
if (hoursIndia == 0)
{
hoursIndia = 12;
}
if (minutesIndia <= 9)
{
minutesIndia = "0" + minutesIndia;
}
if (secondsIndia <= 9)
{
secondsIndia = "0" + secondsIndia;
}

Indiatime = "<b>"+ hoursIndia + ":" + minutesIndia + ":" + secondsIndia + " " + dn + "</b>";

if (document.layers)
{
document.layers.clockIndia.document.write(Indiatime);
document.layers.clockIndia.document.close();
}
else if (document.all)
{
clockIndia.innerHTML = Indiatime;
}
setTimeout("GMTClock()", 1000)
}
</script>
</head>
<TABLE cellSpacing="0" cellPadding="0" border="0"> <!--Table containing Flags and time of different countries-->
<tr>
<td vAlign="center" align="middle"><asp:image id="imgInd" ImageUrl="../Images/India.gif" Runat="server"></asp:image></td>
</tr>
<tr>
<td vAlign="center" align="middle" height="15"></td>
</tr>
<tr>
<td vAlign="center" align="middle"><span class="linkopenbold" id="clockIndia" style="POSITION: relative"></span></td>
</tr>
</TABLE>

What changes should I made to make clock of more than one country on the same page through Java Script.
  • Topic Stats
  • Top Replies
  • Link to this Topic
Type: Discussion • Score: 1 • Views: 548 • Replies: 0
No top replies

 
 

Related Topics

Webdevelopment and hosting - Question by harisit2005
Showing an Ico File - Discussion by Brandon9000
how to earn money in internet - Discussion by rizwanaraj
The version 10 bug. Worse then Y2K! - Discussion by Nick Ashley
CSS Border style colors - Question by meesa
There is no Wisdom in Crowds - Discussion by ebrown p
THANK YOU CRAVEN AND NICK!!! - Discussion by dagmaraka
I'm the developer - Discussion by Nick Ashley
 
  1. Forums
  2. » Digital clock of two or more countries on same page
Copyright © 2025 MadLab, LLC :: Terms of Service :: Privacy Policy :: Page generated in 0.03 seconds on 01/19/2025 at 02:36:26