title: Declaring variables in javascript functions
body: <p>I have written the following code to validate logins. It will now only check one user ID and password. I want to create a string array to check IDs and passwords but when I try to declare a variable, the function <code>check</code> is reported as not defined.</p>
  
  <pre><code>&lt;html&gt;
    &lt;head&gt;
      &lt;title&gt;Login page&lt;/title&gt;
    &lt;/head&gt;
    &lt;body&gt;
      &lt;h1 style="font-family:Comic Sans Ms;text-align="center";font-size:20pt color:#00FF00;&gt;Simple Login Page&lt;/h1&gt;
      &lt;form name="login"&gt;
        Username&lt;input type="text" name="userid"/&gt;
        Password&lt;input type="password" name="pswrd"/&gt;
        &lt;input type="button" onclick="check(this.form)" value="Login"/&gt;
        &lt;input type="reset" value="Cancel"/&gt;
      &lt;/form&gt;
      &lt;script language="javascript"&gt;
        "use strict"
        function check(form)/*function to check userid &amp; password*/
        {
          int a;
          a = 1;
          if(form.userid.value == "jscholl" &amp;&amp; form.pswrd.value == "astronomy")
          {
            window.open("index.html");
          }
          else
          {
            alert("Error Password or Username")/*displays error message*/
          }
        }
      &lt;/script&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>