mardi 15 septembre 2015

Using Javascript: I want to use a checkbox to alter a var's output

I have looked everywhere, and I cannot seem to find anything that does what I need it to do. I would love for my script to check against the vars I have put in for date and time and automatically calculate DST, but that is way more involved than I can get. Instead, I just want a simple checkbox to subtract an hour from the var's attributes.

  
/*Define Zones*/
  var edt = values[3];
  var pdt = values[3];
  var cet = values[3];
  
/*This is for the timezone calculator*/

if ( ((values[0] == 'march') && (values[1] > '8')) || (values[0] == 'april') || (values[0] == 'may') || (values[0] == 'june') || (values[0] == 'july') || (values[0] == 'august') || ( (values[0] == 'november') && (values[1] != '1')) ) {
                edt = values[3] - 3;
                pdt = values[3] - 6;
                cet = values[3] - - 1;
} 
else {
                edt = values[3] - 4;
                pdt = values[3] - 7;
                cet = values[3] - - 2;
}

  /*This puts the world time clock in */
var anchor = 'http://ift.tt/1Mq0p9p' + a_month + '-' + a_date + 'T' + values[3] + ':' + values[7] + ':00';

  /*Subtracts the hours for CET/PDT/EDT 
  var edt = values[3] - 3;
  var pdt = values[3] - 7;
  var cet = values[3] - -2;
*/
  var times = [values[3], edt, pdt, cet];

  /*This is for the the pluralization of hours */
                /*English hour text */
                if (values[4] == '1') {
                        var hourtext = 'hour';
                } 
                else { var hourtext = 'hours';
                }
                /* FR hour text */
                if (values[4] == '1') {
                        var frhourtext = 'heure';
                } 
                else { var frhourtext = 'heures';
                }
                /*DE hour text */
                if (values[4] == '1') {
                        var dehourtext = 'stunde';
                } 
                else { var dehourtext = 'stunden';
                }

  /*This is to validate the checkbox */
var validate = 'Not Checked';

if ($('.ckDst').is(':checked')) {
        edt = values[3] - 4;
                pdt = values[3] - 7;
                cet = values[3] - - 2;
} else if {
                edt = values[3] - 3;
                pdt = values[3] - 6;
                cet = values[3] - - 1;
}
else {
}
 
  
  
 /*This is to put in DST */
                if ($('.ckDst') == ':checked') {
                edt = values[3] - 4;
                pdt = values[3] - 7;
                cet = values[3] - - 2;
                } 
                else { 
                edt = values[3] - 3;
                pdt = values[3] - 6;
                cet = values[3] - - 1;
                }

I have the full code, with HTML and CSS here: http://ift.tt/1FLcn5D

While I will gladly take all suggestions, I really just want the danged checkbox to do what I tell it to!

Thanks!




Aucun commentaire:

Enregistrer un commentaire