title: External javascript does not seem to connect to html page
body: <p>I'm trying to use an external javascript, but when I run my html page it does seem as though my external javascript is working. I'm not too sure if it's my coding in my javascript or if I haven't connected the javascript correctly. As I wanted an alert message to put when certain things weren't met, i.e email must have @ or postcode must have 4 numbers. Any help would be appreciated.</p>
  
  <p>Here is my html code:</p>
  
  <pre><code>&lt;html&gt;
    &lt;head&gt;
      &lt;script type="text/javascript" src="/new 2.js"&gt;&lt;/script&gt;
    &lt;/head&gt;
    &lt;body&gt;
      &lt;form name="userForm" onsubmit= "return validateForm()"  method="post"&gt;
        Name: &lt;input type="text" id="name" name="name" size="50" required /&gt;
        &lt;br /&gt;&lt;br /&gt;
        Address: &lt;input type= "text" id="address" name="Address" size="50" required/&gt;
        &lt;br /&gt;&lt;br /&gt;
        Postcode: &lt;input type="text" id="postcode" name="postcode" size="4" required/&gt;
        &lt;br&gt;&lt;br/&gt;
        Email: &lt;input type="text" id="email" name="email" required/&gt;
        &lt;br&gt;&lt;br/&gt;
        Credit Card Details:
        &lt;br /&gt;
        &lt;select name="Card Type"&gt;
          &lt;option value="Visa"&gt;Visa&lt;/option&gt;
          &lt;option value="Mastercard"&gt;Mastercard&lt;/option&gt;
          &lt;option value="AMEX"&gt;AMEX&lt;/option&gt;
        &lt;/select&gt;
        &lt;br&gt;&lt;br/&gt;
        &lt;select name="Month"&gt;
          &lt;option value="1"&gt;January&lt;/option&gt;
          &lt;option value="2"&gt;Febuary&lt;/option&gt;
          &lt;option value="3"&gt;March&lt;/option&gt;
          &lt;option value="4"&gt;April&lt;/option&gt;
          &lt;option value="5"&gt;May&lt;/option&gt;
          &lt;option value="6"&gt;June&lt;/option&gt;
          &lt;option value="7"&gt;July&lt;/option&gt;
          &lt;option value="8"&gt;August&lt;/option&gt;
          &lt;option value="9"&gt;September&lt;/option&gt;
          &lt;option value="10"&gt;October&lt;/option&gt;
          &lt;option value="11"&gt;November&lt;/option&gt;
          &lt;option value="12"&gt;December&lt;/option&gt;
        &lt;/select&gt;  
        &lt;br&gt;&lt;br/&gt;
        &lt;select name="Year"&gt;
          &lt;option value="2014"&gt;2014&lt;/option&gt;
          &lt;option value="2015"&gt;2015&lt;/option&gt;
          &lt;option value="2016"&gt;2016&lt;/option&gt;
          &lt;option value="2017"&gt;2017&lt;/option&gt;
          &lt;option value="2018"&gt;2018&lt;/option&gt;
          &lt;option value="2019"&gt;2019&lt;/option&gt;
          &lt;option value="2020"&gt;2020&lt;/option&gt;
          &lt;option value="2021"&gt;2021&lt;/option&gt;
          &lt;option value="2022"&gt;2022&lt;/option&gt;
          &lt;option value="2023"&gt;2023&lt;/option&gt;
          &lt;option value="2024"&gt;2024&lt;/option&gt;
        &lt;/select&gt;
        &lt;br&gt;&lt;br/&gt;
        &lt;input type="submit" name="Submit" value="Submit Form" /&gt; 
        &lt;br&gt;&lt;br/&gt;
        &lt;input type="reset" name="Reset" Value="Reset Form"&gt;
      &lt;/form&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>This is my external Javascript:</p>
  
  <pre><code>function validateForm()
  {
    if (document.getElementById("name").value=="")
    {
      alert("You cannot leave this field blank. Please enter your name");
    }
    else  
    {
      alert("field OK");
    }
  
    if (document.getElementById ("address").value ==="")
    {
      alert ("Please enter your address");
      document.getElementById ("address").focus();
      return false;
    }
  
    if (isNaN(document.getElementById("postcode").value.length&lt;4))
    {
      alert ("Your postcode is not valid");
    }
    else 
    {
      alert ("You have entered your postcode correctly");
    }
  
    if (document.getElementById ("email").value.length&lt;5 ||
        document.getElementById ("email").value.indexOf("@")== -1) {
      alert("Please enter your email min 5 chars and include @ symbol");
      document.getElementById("email").focus();
      return false;
    }
    {
  
    if (document.getElementById ("creditcard").value.length &lt; 16)
    {
      alert("Please enter your Creditcard number");
      document.getElementById ("ccreditcard").focus();
      return false;
    }
  
    alert("Thank you for your submission!");
    return true;
  }
  }
  </code></pre>