Like so:-
Code:
function calcTime(city, offset) {
d = new Date();
utc = d.getTime() + (d.getTimezoneOffset() * 60000);
nd = new Date(utc + (3600000*offset));
document.myformAfrica.bar.options.selectedIndex = 0;
return " The local date and time in \n \n " + city + " \n \n" + nd.toLocaleString();
}
Or if you prefer:-
Code:
<select id="time" name="bar" onChange="alert(calcTime(document.myformAfrica.bar[document.myformAfrica.bar.selectedIndex].text, document.myformAfrica.bar.options[document.myformAfrica.bar.options.selectedIndex].value));document.myformAfrica.bar.options.selectedIndex = 0;">
Quizmaster: Which African country gives its name to the complaint known as 'gippy tummy'?
Contestant: Venezuela.