title: Simple JavaScript not executing?
body: <p>What could be the cause of the <code>validateDate()</code> function not to execute when called?</p>
  
  <p>The purpose of <code>validateDate()</code> is to take a string like <code>01/01/2001</code> and call <code>isValidDate()</code> to determine if the date is valid.</p>
  
  <p>If it's not valid, then a warning message will appear.</p>
  
  <pre><code> function isValidDate(month, day, year){
      /*
      Purpose: return true if the date is valid, false otherwise
  
      Arguments: day integer representing day of month
      month integer representing month of year
      year integer representing year
  
      Variables: dteDate - date object
  
      */
      var dteDate;
  
      //set up a Date object based on the day, month and year arguments
      //javascript months start at 0 (0-11 instead of 1-12)
      dteDate = new Date(year, month, day);
  
      /*
      Javascript Dates are a little too forgiving and will change the date to a reasonable guess if it's invalid. We'll use this to our 
      advantage by creating the date object and then comparing it to the details we put it. If the Date object is different, then it must
      have been an invalid date to start with...
      */
  
      return ((day == dteDate.getDate()) &amp;&amp; (month == dteDate.getMonth()) &amp;&amp; (year == dteDate.getFullYear()));
   }
  
   function validateDate(datestring){
  
       month = substr(datestring, 0, 2);
       day   = substr(datestring, 2, 2);
       year  = substr(datestring, 6, 4);
  
       if(isValidDate(month, day, year) == false){
           alert("Sorry, " + datestring + " is not a valid date.\nPlease correct this.");
           return false;
       } else {
           return true;
       }
   }
  </code></pre>