I need javascript help

Discussion in 'JavaScript' started by Kankles137, May 11, 2007.

  1. #1
    Im new to javascript, and im trying to write a program that will convert time from eastern to the other 5 u.s. time zones. This is what I have so far...

    <html>
    <title> Time Zones </title>
    <head> <h2> U.S. Time Zones </h2> </head>
    <body>
    <script language='Javascript'>
    function east2cent (hoursBox)
    {return hoursBox - 1;}
    function east2mount (hoursBox)
    {return hoursBox - 2;}
    function east2pac (hoursBox)
    {return hoursBox - 3;}
    function east2alaska (hoursBox)
    {return hoursBox - 4;}
    function east2hawaii (hoursbox)
    {return hoursBox - 5;}

    <var zone=document.timezones.zoneList.value;
    var hours=document.timezones.hoursBox.value;>

    <var ampm = document.timeZones.ampmList.value;
    alert("Input " + hours + ":00 " + ampm + " is valid.");'>

    </script>

    <form name=timezones>
    When it is
    <input type=text name=hoursBox size=6>
    :00
    <select name=ampmList>
    <option value="am">am
    <option value="pm">pm
    </select>
    In the Eastern time zone
    <p>It is

    <input type=text name=shiftedTimeBox size=8>
    return document.timezones.shiftedTimeBox.value="";

    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
    </select>
    Time zone
    <p> </p>
    <input type=button value="Update"
    if (zone == "Central")
    onclick="document.timezones.shiftedTimeBox.value=east2cent(document.timezones.hoursBox.value)";
    if (zone == "Mountain")
    onclick="document.timezones.shiftedTimeBox.value=east2mount(document.timezones.hoursBox.value)";
    if (zone == "Pacific")
    onclick="document.timezones.shiftedTimeBox.value=east2pac(document.timezones.hoursBox.value)";
    if (zone == "Alaska")
    onclick="document.timezones.shiftedTimeBox.value=east2alaska(document.timezones.hoursBox.value)";
    if (zone == "Hawaii")
    onclick="document.timezones.shiftedTimeBox.value=east2hawaii(document.timezones.hoursBox.value)";>

    </form>
    </body>

    </html>

    any help would be greatly appreciated, thanks alot
     
    Kankles137, May 11, 2007 IP