Click to See Complete Forum and Search --> : Time Zone Script
okanst
02-01-2006, 09:26 AM
Hello,
I am trying to fix this script to automatically detect what time Zone the user is in and post the corresponding time zones automatically instead of using the drop down menu that is provided. I would like to remove that option entirely. I'm having problems with it.
can anyone help?
Thanks!
James Gatka
02-01-2006, 09:53 AM
Insert this code, where shown, just above the closing Script tag:
function getLocalOffset(){
var now = new Date();
var localGMToffset = now.getTimezoneOffset()/60*-1;
if (localGMToffset == -8){document.getElementById('LocalTimeZone').selectedIndex
= 1}
if (localGMToffset == -7){document.getElementById('LocalTimeZone').selectedIndex
= 2}
if (localGMToffset == -6){document.getElementById('LocalTimeZone').selectedIndex
= 3}
if (localGMToffset == -5){document.getElementById('LocalTimeZone').selectedIndex
= 4}
if (localGMToffset == -4){document.getElementById('LocalTimeZone').selectedIndex
= 5}
if (localGMToffset ==
-3.5){document.getElementById('LocalTimeZone').selectedIndex = 6}
showtime();
}
onload=getLocalOffset;
//-->
</SCRIPT>
</HEAD>
<BODY bgColor="#d7faff" topmargin="2">
okanst
02-01-2006, 01:26 PM
Thank you so much!!
Brilliant!! You are a life saver!!! :D :D :D