title: How to make the current time appear in an alert box
body: <p>How does one make the current time appear in an alert box? I'm new to programming, so I'm completely lost. I'm coding in html5 or javascript. I've added most of my code here. </p>
  
  <p>Here's my code:</p>
  
  <pre><code>&lt;script&gt;
      function startTime(){
          var today=Date();
          var h=today.getHours();
          var m=today.getMinutes();
          var s=today.getSeconds(); 
          document.getElementById('txt').innerHTML=h+":"+m+":"+s; 
      }
  
  &lt;/script&gt;
  &lt;div id="txt"&gt;&lt;/div&gt;
  
  &lt;h1&gt;What would you like it to say?&lt;/h1&gt;
  
      &lt;p&gt;Commmon Requests:&lt;/p&gt;
  
      &lt;form action=""&gt;
      &lt;select name="requests" onchange ="checkIfOther();" id="dropDown1"&gt;
      &lt;option value="blank"&gt; &lt;/option&gt;
      &lt;option value="good morning sir"&gt;Good Morning Sir&lt;/option&gt;
      &lt;option value="current time"&gt;Current Time&lt;/option&gt;
      &lt;option value="other"&gt;Other&lt;/option&gt;    
      &lt;/select&gt;
      &lt;/form&gt;
  
      &lt;/p&gt;
  &lt;button onclick="mySubmit()" value&gt;Submit&lt;/button&gt;
  
      &lt;div id="other" style="display:none"&gt;
          &lt;br&gt;&lt;br&gt;&lt;label&gt;Optional Request: &lt;/label&gt;&lt;input type="text" id="otherText"/&gt;
      &lt;/div&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  
  &lt;script&gt;
      function checkIfOther(){
          a=document.getElementById("dropDown1");        
          if(a.value == "other"){           
              document.getElementById("other").setAttribute("style","display:inline");
          }
          else{
              document.getElementById("other").setAttribute("style","display:none");
              }
      }   
  &lt;/script&gt;
  
  &lt;script type="text/javascript"&gt;
      function mySubmit(){
          var x=document.getElementById("dropDown1");
          if(x.value == "other"){
              alert("You have chosen: " + otherText.value); 
          }
          else if(x.value == "current time"){
              alert("The current time is: " + 'txt'.value); //what do I do here?
          }
          else{   
              alert("You have chosen: " + x.options[x.selectedIndex].text);
          }   
      }   
  &lt;/script&gt;
  </code></pre>
  
  <p>Am I doing something wrong? </p>