title: validation gives an error of uncaught reference
body: <p>Hello I have created a page using bootstrap but now I am facing form validation problem. I tried all possible medium using required attribute also. But event is not getting generated on clicking the button. Its a easiest question but still I am in trouble. Please provide me guidance 
  This is Home.html page</p>
  
  <hr>
  
  <hr>
  
  <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 validate(){
  var name=document.myForm.fname.value;  
  var email=document.myForm.femail.value;  
   var num = document.myForm.fnumber.value;
    
    if(name== null || email== null || num== null){
    
        alert("Please fill out the fields")
     return false;
    }
    
    else if(name== null &amp;&amp; email== null){
    
      alert("Enter name and email");
   return false;
    }
    
    }</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>body, h1, h2, h3, h4, h5, h6 {
      font-family: 'Montserrat', sans-serif;
  }
  
  .site-nav {
      border-bottom: 10px solid #e02517;
      padding: 10px;
      margin-bottom: 0px
  }
  
  /*hr.firstline
  {
   margin-top: -20px;
      margin-bottom: 37px;
      border: 0;
      border-top: 13px solid #e02517;
  }*/
  hr
  {
   margin-top: 0px;
      margin-bottom: 20px;
      border: 0;
      border-top: 16px solid #337ab7;
  }
  .navbar-default .navbar-nav&gt;li {
      color: #777;
      margin-left: 396px;
      margin-top: 4px;
  }
  
  .title{
   font-weight: 700;
      font-size: x-large;
      color: #cc0d0d;
  }
  
  .subtitle{
   
       margin: 0 0 10px;
      font-size: medium;
      color: #337ab7;
  }
  .content{
   color: #cc0d0d;
   margin-top: -18px;
      margin-bottom: 0px;
  }
  
  .container-fluid {
      padding-right: 15px;
      padding-left: 15px;
      margin-right: auto;
      margin-left: auto;
      background-color: #cc0d0d;
   height:51px;
  }
  
  .nav-inverse{
   
   background-color:none;
  }
  
  /*.navbar {
      position: relative;
      min-height: 50px;
      margin-bottom: 20px;
      border: 0px solid transparent;
  }*/
  
  .navbar-inverse .navbar-nav&gt;li&gt;a {
      color: white;
      margin-left: 327px;
      font-size: 17px;
  }
  
  .content1{
   
   font-size: 18px;
   
  }
  .last{
  
      margin-top: -20px;
   border-top: 10px solid #337ab7;
  }
  
  .nav&gt;li {
      position: relative;
      display: block;
      margin-bottom: -7px;
      margin-top: 18px;
      margin-left: 317px;
      color: white;
  }
  
  #content3{
   
   color:#cc0d0d;
   font-size:18px;
  }
  
  #content2{
   
   color:#337ab7;
   font-size:18px;
   margin-left: 190px;
  }
  #logo{
   
   vertical-align: middle;
      width: 77px;
      margin-bottom: 14px;
      margin-left: 230px;
   }
   
   #logo1 {
      vertical-align: middle;
      width: 130px;
      margin-bottom: 14px;
      margin-left: 8px;
  }
  
  .form1{
      
      margin-left: 44px;
      border: WHITE;
      width: 208px;
      margin-top:9px;
  }
  .form2{
      margin-left: 42px;
      border: WHITE;
      width: 206px;
      margin-top: 3px;
  }
  
  .form3{
      margin-left: 36px;
      border: WHITE;
      width: 208px;
      margin-top: 4px;
  }
  
  #first{
  font-size: x-large;
      margin-top: -16px;
      align-items: center;
      
  }
  
  #first1{
      color:#cc0d0d;
  }
  #first2{
      
      color: #337ab7;
  }
  
  #second{
          font-size: 17px;
      margin-left: 19px;
  }
  #second1{
      color:#337ab7;
  }
  
  .btn{
   
   border-radius:-88px;
   width:140px;
  }
  
  .page-header {
      padding-bottom: -9px;
      /*margin: -9px 29px -21px;*/
      /*margin-bottom: 6px;
      margin-left: 2px;*/
      border-bottom: 2px solid #cc0d0d;
      border-bottom-width: -3px;
      border-radius: -64;
      margin: 20px 0 20px;
  }
  
  #content12{
      margin-left:42px;
      color:#337ab7;
      }
      .logo21{
          vertical-align: middle;
      margin-left: -34px;
      width: 397px;
  }
      
  
  
  .panel {
      -webkit-box-shadow: 0 1px 2px rgba(0,0,0,.05);
      box-shadow: 0 1px 2px rgba(0,0,0,.05);
      margin-top: -115px;
      width: 398px;
      /* margin-right: -7px; */
  }
  .panel-primary {
      border-color: #337ab7;
      margin-left: 371px;
  }
  .panel-heading {
      padding: 11px 15px;
      border-bottom: 4px solid transparent;
      font-size: 17px;
      border-top-left-radius: 1px;
      border-top-right-radius: 3px;
      background-color: white;
  }
  
  /** BANNER SECTION */
  
  .banner-parent {
      height: 500px;
      overflow: hidden;
  }
  
  .banner {
      padding: 15px;
      background-color: #eee;
  }
  
  .banner-background {
      position: absolute;
      z-index: -1;
  }
  
  .banner-background img {
      width: 100%
  }
  
  #back1
  {
     
     margin-top: -38px;
      width: 1140px;
      height: 509px;
  }
  
  .panel-primary {
      border-color: #337ab7;
      margin-left: 278px;
      margin-top: -70px;
      width: 584px;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  
  &lt;head&gt;
   &lt;title&gt;Bootstrap Example&lt;/title&gt;
   &lt;meta charset="utf-8"&gt;
   &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;
   &lt;link href='https://fonts.googleapis.com/css?family=Montserrat' rel='stylesheet' type='text/css'&gt;
   &lt;!-- Latest compiled and minified CSS --&gt;
   &lt;link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous"&gt;
   &lt;!-- Optional theme --&gt;
   &lt;!-- Latest compiled and minified JavaScript --&gt;
   &lt;script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"&gt;&lt;/script&gt;
   &lt;link rel="stylesheet" href="style.css"&gt;
   &lt;link rel="stylesheet" href="style1.css"&gt;
  
  &lt;/head&gt;
  
  &lt;body&gt;
   &lt;div class="container"&gt;
    &lt;nav class="navbar navbar-default site-nav"&gt;
     &lt;div class="container"&gt;
      &lt;div class="navbar-header"&gt;
       &lt;img id="logo" src="images\\logo.png"&gt;
       &lt;img id="logo1" src="images\\logo1.jpg"&gt;
       &lt;label id="content2"&gt; CALL &lt;/label&gt;
       &lt;label id="content3"&gt;555-123-4567 &lt;/label&gt;
       &lt;/LI&gt;
      &lt;/div&gt;
     &lt;/div&gt;
    &lt;/nav&gt;
    &lt;div class="row"&gt;
     &lt;div class="col-md-12 banner-parent"&gt;
      &lt;div class="banner-background"&gt;
       &lt;img id="back1" src="images\\back.png"&gt;
       &lt;hr&gt;
      &lt;/div&gt;
      &lt;div class="row"&gt;
       &lt;div class="col-md-3"&gt;&lt;/div&gt;
       &lt;div class="col-md-6 text-center banner"&gt;
        &lt;div class="page-header"&gt;
         &lt;h3 id="first"&gt;&lt;label id="first1"&gt; PROFESSIONAL&lt;/label&gt; &lt;label id="first2"&gt; PAINTERS &lt;/label&gt; &lt;/h3&gt;
         &lt;h4 id="second"&gt;&lt;label id="second1"&gt; OF LARGO,CLEANWATER,TAMPA &lt;/label&gt; &lt;/H4&gt;
        &lt;/div&gt;
        &lt;h4 id="content12"&gt; We Care About More Than Paint! &lt;/h4&gt;
        &lt;img src="images\\logo2.jpg" class="logo21"&gt;
                             
    &lt;form name="myForm" class="form-signin" method="post" action="welcome.html" onsubmit="return validate()"&gt;
         &lt;label&gt;NAME: &lt;/label&gt;
         &lt;input name="fname" type="text" class="form1"&gt;
         &lt;br/&gt;
         &lt;label&gt;EMAIL: &lt;/label&gt;
         &lt;input name="femail" type="email" class="form2"&gt;
         &lt;br/&gt;
         &lt;label&gt;PHONE: &lt;/label&gt;
         &lt;input name="fnumber" type="text" class="form3"&gt;
         &lt;center&gt;
          &lt;button type="button" class="btn btn-danger"&gt;
           &lt;label&gt;SAVE $150
            &lt;/label&gt;
          &lt;/button&gt;
         &lt;/center&gt;
        &lt;/form&gt;
       &lt;/div&gt;
       &lt;div class="col-md-3"&gt;&lt;/div&gt;
      &lt;/div&gt;
      &lt;div class="panel panel-primary"&gt;
       &lt;div class="panel-heading"&gt;&lt;span class="glyphicon glyphicon-ok-circle"&gt;&lt;/span&gt;Quality Work &amp;nbsp;
        &lt;span class="glyphicon glyphicon-ok-circle"&gt;&lt;/span&gt; Professional Painters &amp;nbsp;
        &lt;span class="glyphicon glyphicon-ok-circle"&gt;&lt;/span&gt; Flexible Schedules
       &lt;/div&gt;
      &lt;/div&gt;
     &lt;/div&gt;
    
    &lt;/div&gt;
    
    &lt;!-- End of header --&gt;
    &lt;div class="row"&gt;
     &lt;div class="col-md-2"&gt;
     &lt;/div&gt;
     &lt;div class="col-md-8"&gt;
      &lt;strong class="title"&gt;Professional Painters &lt;/strong&gt; &lt;/br&gt;
      &lt;strong class="subtitle"&gt;Tackling Residential &amp; Commerical Painting Projects&lt;/strong&gt; &lt;/br&gt;
      &lt;p&gt;Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus gravida massa pharetra,
      tempor ligula ut,aliquet nulla. Quisque eu quam turpis. Sed portitor mauris nec quam dignissim, et placerat odio scelerisque. In hac 
      habitussa platea dictumst. Proin et accumsan nunc, sit amet bibenndum parus. Proin at euismod ante. 
        Phasellus ipsum orcii feugiat tristique mollis vitae, sagittis sollicitudin libero.In lompus &lt;br/&gt;ex non ipsum prctium, ae
      conseqaut justo fringilla. &lt;/p&gt;
     &lt;/div&gt;
     &lt;div class="col-md-2"&gt;
     &lt;/div&gt;
    &lt;/div&gt;
    &lt;!--End of first part --&gt;
    &lt;br/&gt;
    &lt;div class="row"&gt;
     &lt;div class="col-md-2"&gt;
     &lt;/div&gt;
     &lt;div class="col-md-8"&gt;
      &lt;strong class="subtitle"&gt;Why Clients Choose To Hire Our Team: &lt;/strong&gt; &lt;/br&gt;
      &lt;p&gt;
       &lt;label class="content"&gt; &lt;img src="images\\listicon.png"&gt; Mauris sit amet urna etleo pulvinar tristique &lt;/label&gt;
      &lt;/p&gt;
      &lt;p&gt;
       &lt;label class="content"&gt; &lt;img src="images\\listicon.png"&gt; Nameu eros mollis, interdum sapren tincidant accumsan erat. &lt;/label&gt;
      &lt;/p&gt;
      &lt;p&gt;
       &lt;label class="content"&gt; &lt;img src="images\\listicon.png"&gt; Maecenas rutrum libero ac drum volutpat, eu veucula risas molestre &lt;/label&gt;
      &lt;/p&gt;
      &lt;p&gt;
       &lt;label class="content"&gt; &lt;img src="images\\listicon.png"&gt; Mauris et tellus in lucas effucutar fringilla &lt;/label&gt;
      &lt;/p&gt;
      &lt;p&gt;
       &lt;label class="content"&gt; &lt;img src="images\\listicon.png"&gt; Naliam lacinia nulla eget quam ornaz blandit&lt;/label&gt;
      &lt;/p&gt;
      &lt;p&gt;
       &lt;label class="content"&gt; &lt;img src="images\\listicon.png"&gt; Sed mollis magna eu mi allquet scalerisque&lt;/label&gt;
      &lt;/p&gt;
     &lt;/div&gt;
     &lt;div class="col-md-2"&gt;
     &lt;/div&gt;
    &lt;/div&gt;
    &lt;!-- End of 2nd part--&gt;
    &lt;div class="row"&gt;
     &lt;div class="col-md-2"&gt;
     &lt;/div&gt;
     &lt;div class="col-md-8"&gt;
      &lt;p&gt;
       Donec allquem sit amet nisised consequent. Ttiam gravida nisi. Interdam et malesuada fames ac ante ipsum
       primia in faucibus. Aeneam feugiat lacinia velit non lacinia. Proin eget tristique leo.
      &lt;/p&gt;
     &lt;/div&gt;
     &lt;div class="col-md-2"&gt;
     &lt;/div&gt;
    &lt;/div&gt;
    &lt;!-- end of 3rd part--&gt;
    &lt;!-- footer navbar--&gt;
    &lt;nav class="navbar navbar-inverse"&gt;
     &lt;div class="container-fluid"&gt;
      &lt;div class="navbar-header"&gt;
      &lt;/div&gt;
      &lt;ul class="nav navbar-nav"&gt;
       &lt;li&gt;
        &lt;label&gt;SCHEDULE YOUR FREE ESTIMATE!&lt;/label&gt;
        &lt;label class="content1" style="
    font-size: 25px;  padding-left: 11px; padding-bottom: 0px;  padding-top: 7px; margin-top: -19px;"&gt; 555-123-4567&lt;/label&gt;
       &lt;/li&gt;
      &lt;/ul&gt;
     &lt;/div&gt;
    &lt;/nav&gt;
    &lt;hr class="last"&gt;
   &lt;/div&gt;
   
   &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"&gt;&lt;/script&gt;
   &lt;script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"&gt;&lt;/script&gt;
  
    &lt;script src="validation.js"&gt;
   &lt;/body&gt;
  
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>