I am trying to get multiple variable to one URL. My problem is coming from my JavaScript code. I need to add if/then statements to the code. The user will select a date and time but I need the date/time to change to zulu time so when they click on the button it will open up the page with the correct ZULU time. I italiced the code that I need help with. Suggestions??? Thx

<p>QPE - Gauge Adj. Radar<br></p>
Select data ending date, time and timestep:<br>

<form name="SelectURL6" id="SelectURL6">
<select name="ME">
  <option VALUE="1" selected> January </option>
  <option VALUE="2"> February </option>
  <option VALUE="3"> March </option>
  <option VALUE="4"> April </option>
  <option VALUE="5"> May </option>
  <option VALUE="6"> June </option>
  <option VALUE="7"> July </option>
  <option VALUE="8"> August </option>
  <option VALUE="9"> September </option>
  <option VALUE="10"> October </option>
  <option VALUE="11"> November </option>
  <option VALUE="12"> December </option></select>
<select name="DE">
  <option VALUE="1" selected> 1 </option>
  <option VALUE="2"> 2 </option>
  <option VALUE="3"> 3 </option>
  <option VALUE="4"> 4 </option>
  <option VALUE="5"> 5 </option>
  <option VALUE="6"> 6 </option>
  <option VALUE="7"> 7 </option>
  <option VALUE="8"> 8 </option>
  <option VALUE="9"> 9 </option>
  <option VALUE="10"> 10 </option>
  <option VALUE="11"> 11 </option>
  <option VALUE="12"> 12 </option>
  <option VALUE="13"> 13 </option>
  <option VALUE="14"> 14 </option>
  <option VALUE="15"> 15 </option>
  <option VALUE="16"> 16 </option>
  <option VALUE="17"> 17 </option>
  <option VALUE="18"> 18 </option>
  <option VALUE="19"> 19 </option>
  <option VALUE="20"> 20 </option>
  <option VALUE="21"> 21 </option>
  <option VALUE="22"> 22 </option>
  <option VALUE="23"> 23 </option>
  <option VALUE="24"> 24 </option>
  <option VALUE="25"> 25 </option>
  <option VALUE="26"> 26 </option>
  <option VALUE="27"> 27 </option>
  <option VALUE="28"> 28 </option>
  <option VALUE="29"> 29 </option>
  <option VALUE="30"> 30 </option>
  <option VALUE="31"> 31 </option></select>
<select name="YE">
  <option SELECTED value="2012">2012</option>
  <option value="2011">2011</option></select>
<select name="TE">
  <option VALUE="7" selected>12:00 Midnight</option>                  <option VALUE="8">1:00 AM</option>                  
  <option VALUE="9">2:00 AM</option>
  <option VALUE="10">3:00 AM</option>                  
  <option VALUE="11">4:00 AM</option>
  <option VALUE="12">5:00 AM</option>                  
  <option VALUE="13">6:00 AM</option>
  <option VALUE="14">7:00 AM</option>                  
  <option VALUE="15">8:00 AM</option>
  <option VALUE="16">9:00 AM</option>                  
  <option VALUE="17">10:00 AM</option>
  <option VALUE="18">11:00 AM</option>                  
  <option VALUE="19">12:00 Noon</option>
  <option VALUE="20">1:00 PM</option>                  
  <option VALUE="21">2:00 PM</option>
  <option VALUE="22">3:00 PM</option>                  
  <option VALUE="23">4:00 PM</option>
  <option VALUE="24">5:00 PM</option>
  <option VALUE="0">6:00 PM</option>                  
  <option VALUE="1">7:00 PM</option>
  <option VALUE="2">8:00 PM</option>                  
  <option VALUE="3">9:00 PM</option>
  <option VALUE="4">10:00 PM</option>                  
  <option VALUE="5">11:00 PM</option>
  <option VALUE="6">12:00 PM</option></select>   
<select name="TS">
  <option VALUE="1">1-hour</option>
  <option VALUE="3">3-hour</option>
  <option VALUE="6">6-hour</option>
  <option VALUE="12">12-hours</option>
  <option SELECTED value="24">24-hours</option>
  <option VALUE="48">48-hours</option>
  <option VALUE="72">72-hours</option></select><br><br>
<input type="button" value="Get QPE Map" id="submit">
    </form>




function listen(event, elem, func) {
  if (elem.addEventListener) return elem.addEventListener(event, func, false);
  else return elem.attachEvent('on' + event, func);    
}

var form = document.getElementById('SelectURL6'),
    btn = document.getElementById('submit');
listen('click', btn, function() {
    var selectElems = form.getElementsByTagName('select'),

* TE = TE+7;
if (ME==12 && DE==31 && TE>24){
return (YE==YE + 1 && ME==1 && DE==1 && TE==TE -24);
}
if (DE==31 && TE>24){
return (ME==ME + 1 && DE==1 && TE==TE - 24);
}
if (DE==30 && ME==4 && TE==24){
return (ME==ME + 1 && DE==1 && TE==TE - 24);
}
if (DE=30 && ME==6 && TE==24){
return (ME=ME + 1 && DE==1 && TE==TE - 24);
}
if (DE==30 && ME==9 && TE==24){
return (ME==ME + 1 && DE==1 && TE==TE - 24);
}
if (DE==30 && ME==12 && TE==24){
return (ME==ME + 1 && DE==1 && TE==TE - 24);
}
if (TE>24){
TE==TE - 24 && DE==DE + 1
}*
get_qpe(selectElems);
});

function get_qpe(elems) {
    var url = '',
        YE, ME, DE, TE, TS, val = 0,
        names = [],
        thisElem;
    for (var i = 0; i < elems.length; i += 1) {
        thisElem = elems[i];
        names.push(thisElem.getAttribute('name'));
        val = thisElem.options[thisElem.selectedIndex].value;
        switch (names[i]) {
        case 'YE':
            YE = val;
            break;
        case 'ME':               
            ME = val;
            break;
        case 'DE':
            DE = val;
            break;
        case 'TE':
            TE = val;
            break;
        case 'TS':
            TS = val;
            break;
        }
    }
    url = "http://nmq.ou.edu/cgi-bin/tools_QPE.cgi?1+0+2+" + YE + "+" + ME + "+" + DE + "+" + TE + "+0+0+34.50+-114.00+32.50+800+632+4101+0+0+1+0+Q2RAD_HSR_GC+Q2RAD_HSR_GC+" + TS + "+english+none+CNTY";
    window.open(url);
}
Member Avatar for LastMitch

he user will select a date and time but I need the date/time to change to zulu time so when they click on the button it will open up the page with the correct ZULU time. I italiced the code that I need help with. Suggestions??? Thx

Change type=button to type=submit

from this:

<input type="button" value="Get QPE Map" id="submit">

to this:

<input type="submit" value="Get QPE Map" id="submit">

Apparently someone did help you with the javascript:

http://stackoverflow.com/questions/11993383/getting-multiple-variables-to-one-url-address

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.