title: Form Validation won't work using javascript/html
body: <p>I've been testing my code all day, but nothing happens. The form automatically opens the success.html and doesn't use the script.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code> function FormValidation(theForm) {
       var errors = "";
       var alph = /^[\w ]+$/;
       var cardnumb = /^\d{16}$/;
       var cvvnumb = /^\d{3}$/;
       var monthnumb = /^\d{1,2}$/;
       var yearnumb = /^\d{4}$/;
  
       if (form.one.value == "") {
           errors += "Please enter your full name! \n";
    }
  
       else if (!alph.test(form.one.value)) {
           errors += "Full name is wrong or includes invalid characters! \n";
       }
       if (form.two.value == "") {
           errors += "Please enter your 16-digit code! \n";
       }
  
       if (!cardnumb.test(form.two.value)) {
           errors += "Card number does not consist of 16 digits or includes invalid characters! \n";
       }
  
       if (form.three.value == "") {
           errors += "Please enter your month of expiration! \n";
       }
  
       if (!monthnumb.test(form.three.value)) {
           errors += "The month does not consist of 2 digits or includes invalid characters! \n";
       }
        
       if (form.four.value == "") {
           errors += "Please enter your year of expiration! \n";
       }
  
       if (!yearnumb.test(form.four.value)) {
           errors += "The year does not consist of 4 digits or includes invalid characters! \n";
       }
  
       if (form.five.value == "") {
           errors += "Please enter your 3-digit CVV code! \n";
       }
  
       if (!cvvnumb.test(form.five.value)) {
           errors += "The CVV does not consist of 3 digits or includes invalid characters! \n";
       }
        
       if (!content == "") {
        alert(content);
        return false;
    }
   }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code> &lt;!DOCTYPE html&gt;
      &lt;html lang="en-US" class="Html" id="Main" dir="auto"&gt;
      &lt;head class="Head" id="Main"&gt;
   &lt;link rel="stylesheet" type="text/css" href="style.css"&gt;
   &lt;meta name="description" content="NRN"&gt;
   &lt;meta name="author" content="NRN"&gt;
   &lt;title class="Title" id="Title"&gt;NRN&lt;/title&gt;
  
     
      &lt;/head&gt;
      &lt;body class="Body" id="Main"&gt;
   &lt;nav&gt;
      &lt;ul&gt;
        &lt;li&gt;&lt;a href="index.html"&gt;Home&lt;/a&gt;&lt;/li&gt;
      &lt;/ul&gt;
   &lt;/nav&gt;
   &lt;p class="p1"&gt;Payment form validation using JavaScript&lt;p&gt;
   &lt;form method="POST" action="success.html" class="myForm" name="myForm" onSubmit="javascript:return FormValidation(this)"&gt;
   &lt;div class="form-group-name"&gt;
          &lt;label for="name"&gt;Owner&lt;/label&gt;&lt;br&gt;
          &lt;input type="text" placeholder="Name on card" class="form-control-1" id="one" name="one"&gt;
      &lt;/div&gt;
      &lt;div class="form-group-number"&gt;
          &lt;label for="number"&gt;Card number&lt;/label&gt;&lt;br&gt;
          &lt;input type="text" placeholder="16-digit code" class="form-control-2" id="two" name="two"&gt;
      &lt;/div&gt;
      &lt;div class="form-group-date"&gt;
          &lt;label for="date"&gt;Expiration date&lt;/label&gt;&lt;br&gt;
          &lt;input type="text" placeholder="Month" class="form-control-3" id="three" name="three"&gt;
          &lt;input type="text" placeholder="Year" class="form-control-3" id="four" name="four"&gt;
      &lt;/div&gt;
      &lt;div class="form-group-cvv"&gt;
          &lt;label for="cvv"&gt;CVV&lt;/label&gt;&lt;br&gt;
          &lt;input type="text" placeholder="3-digit code" class="form-control-4" id="five" name="five"&gt;
      &lt;/div&gt;
      &lt;div class="form-group-submit"&gt;
          &lt;input type="submit" class="submit_form" value="Validate"&gt;
      &lt;/div&gt;
      &lt;/form&gt;
      &lt;/body&gt;
      &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>I have checked everything, as well as many tutorials too, but it doesn't help. Please help! Thanks in advance! Could the problem be in the .css file?</p>