title: Why am I seeing 'function not defined' on my error console when I'm sure my function IS defined?
body: <p>The code I'm using is supposed to change the 'action' attribute for a form based on radio button selection. It doesn't work at the moment and I'm trying to work out why. According to my Firefox error console, the function 'submitForm' is not defined - but I'm sure it is defined!!</p>
  
  <p>Can anyone help?</p>
  
  <p>Code as follows:</p>
  
  <p>Inside the head (q1 refers to the name attribute of the radio buttons):</p>
  
  <pre><code>&lt;script type="text/javascript" src="scripts/javascript.js"&gt;
  function submitForm() {
   if (document.forms[0].q1[1].checked == true) {
    document.forms[0].action = "q2.html";
    }
   else if (document.forms[0].q1[0].checked == true) {
    document.forms[0].action = "q3.html";
    }
   else {
    alert ('Please choose an option');
   }
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>And the event handler:</p>
  
  <pre><code> &lt;form method="post" id="question1" onsubmit="return submitForm();"&gt;
  </code></pre>