title: Scope of JavaScript Variables
body: <p>Is it possible to define some global variables above your functions on the same .html page?</p>
  
  <pre><code>    &lt;script type="text/javascript"&gt;
  
          birthYear = document.getElementById('&lt;%=ddlBirthYear.ClientID %&gt;');
          birthMonth = document.getElementById('&lt;%=ddlBirthMonth.ClientID %&gt;');
          birthDay = document.getElementById('&lt;%=ddlBirthYear.ClientID %&gt;');
  
          function ValidateCardField(validator, args)
          {
              if (args.Value.length &gt; 0)
                  args.IsValid = true;
              else
                  args.IsValid = false;
          }
  ...
  </code></pre>
  
  <p>I'm getting nulls for the variable values.</p>