title: Javascript Validate domain dot com
body: <p>im trying to make a javascript input validator. </p>
  
  <p>I want to check the input if its in the correct domain format. It must check the specific input when the submit button is pressed. </p>
  
  <p>If it is not the correct format, the form will not submit. I am not sure with my RegExp format. Also not sure with the whole code if it will run depending on how i wanted it to be. </p>
  
  <p>Here's my code : </p>
  
  <pre><code>var x1=document.forms["leform"]["domain"].value;
   validomain(x1);
  function validomain(les) {
      var tdomain = new RegExp('/[:alpha:]+/./[:alpha:]+/');
      if(!tdomain.test(les)){
          alert('not a valid domain format');
          return false;
      }
  }
  </code></pre>