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.