Who's good with javascript / html?? Need help!?

  • Thread starter Thread starter moltonboron
  • Start date Start date
M

moltonboron

Guest
Hi everyone,
for my one class I have to make a time converter in html/javascript. Most of the code is done but I just can't figure out how to convert it. Anybody know what I am missing?

code -

<HTML>
<HEAD>
<TITLE>
Eric DiGuglielmo's Time Conversion Page
</TITLE>
<h1>U.S. Time Zones</h1>
</HEAD>
<BODY>
<FORM NAME=timeZones>

When it is

<INPUT TYPE=text NAME=hoursBox SIZE=2>:00
<SELECT NAME=ampmList>
<option value="am">am
<option value="pm">pm
</SELECT>

in the Pacific time zone, it is

<INPUT TYPE=text NAME=shiftedTimeBox SIZE=8>
<SELECT NAME=ampmList>
<option value="am">am
<option value="pm">pm
</SELECT>
in the
<SELECT NAME=zoneList>
<option value="Hawaii">Hawaii
<option value="Alaska">Alaska
<option value="Pacific">Pacific
<option value="Mountain">Mountain
<option value="Central">Central
<option value="Eastern">Eastern
</SELECT>
time zone.

<INPUT TYPE=button VALUE="Update"
onclick='
var hours = parseInt(document.timeZones.hoursBox.value);
if(hours < 1 || hours > 12 || isNaN(hours)) {

alert("Please enter an integer from 1 to 12.");
return;
}
//using alert to display input as reality check
var ampm=document.timeZones.ampmList.value;
alert("Input " + hours + ":00 " + ampm + " is valid.");
var tZone=document.timeZones.zoneList.value;

if(tZone=="Pacific"){
var newHours=hours+0;
}
if(tZone=="Eastern"){
var newHours=hours+3;
}
if(tZone=="Central"){
var newHours=hours+2;
}
if(tZone=="Mountain"){
var newHours=hours+1;
}
if(tZone=="Alaska"){
var newHours=hours-1;
}
if(tZone=="Hawaii"){
var newHours=hours-2;
}
'>
</INPUT>
</FORM>
</BODY>
</HTML>

I've been using notepad in windows to do the code and then opening that file in my firefox web browser to see if it works - anyone see what i am missing??

thanks ahead of time!
 
ok try your code using the compiler blue-j the site to get it is http://www.bluej.org/
 
Back
Top