title: Can't access global variables (Javascript)
body: <pre><code>var hours = document.getElementById("hrs").value; // Global variables declared
  var mins = document.getElementById("min").value; 
  var seconds = document.getElementById("sec").value; 
  
  function random()
  {
      alert(hours);
      alert(mins);
      alert(seconds);
  }
  </code></pre>
  
  <p>The output results as <code>undefined</code> in all 3 cases.</p>