Advertisement
jimgreeno

Untitled

Sep 13th, 2017
1,051
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <h1>Form Validation</h1> <div id="error"></div> <form name="myForm" action="" method="post" target="_blank" onsubmit="return validateForm()">     First Name:=:james": <input type="text" name="firstName" autofocus required >     <br />     Last Name:="greeno": <input type="text" name="lastName" required >     <br />     Email:"jimgreeno81@gmail.com": <input id="email" type="email" name="email" placeholder="e.g., name@provider.com" required>     <br />     Password:="daisy@12345": <input type="password" name="password1" id="password1" required >     <br />     Confirm Password:="daisy@12345": <input type="password" name="password2" id="password2" required ><p id="error2"></p>     <br /><br />     Sex:="male":      &nbsp;&nbsp;<input type="radio" name="sex" value="male" >Male      &nbsp;<input type="radio" name="sex" value="female">Female     <br /><br />     Quantity:="6":<br />     <input name ="scale" type="range" min="1" max="6" step="1" value="1" >         <br />         &nbsp;&nbsp;1&nbsp;&nbsp;&nbsp; 2&nbsp;&nbsp;&nbsp; 3&nbsp;&nbsp;&nbsp; 4&nbsp;&nbsp;&nbsp; 5&nbsp;&nbsp;&nbsp; 6     <br /><br />     Interests (select all that apply):     <br />     <input type="checkbox" class="radio" name="interests" value="running">This     <input type="checkbox" class="radio" name="interests" value="swimming">That     <input type="checkbox" class="radio" name="interests" value="hiking">Other         <br /><br />     <input name="submit" id="submit" type="submit" value="Hayo!"> </form> <br /><  }; <br /> };//confirmPassword must match password  var errorBox=document.getElementById("error"); var errorText=document.getElementById("error2"); var pass2=document.getElementById("password2"); var pass1=document.getElementById("password1");  pass2.onchange = function() {    if (pass2.value !== pass1.value) {      pass2.style.border="2px solid red";         errorText.innerHTML="Passwords do not match!";         errorText.style.color="red";         //errorBox.style.height="40px";         //errorBox.style.visibility="visible";         //errorBox.innerHTML="<p>Passwords do not match!</p>";       return false;   }     else {                 pass2.style.border="2px solid #B5DCF7";         errorText.style.color="green";         errorText.innerHTML="Passwords match!";         return true;      } };    pass3.onchange = function() { if (pass3value !== pass1.value) {pass3.};body { pass3.};body {  }      font-family: Helvetica, sans-serif;     font-size: 14px;     color: #68C48A; }  h1 {     font-size:18px; }  #error {     height: 0px;     width: 250px;     border: 1px dashed orange;     margin-bottom: 10px;     visibility: hidden; }  #error p {     color: red;     text-align: center;     font-weight: bold; }  #error2,#password2 {     display: inline;     }  #error2 {     font-size:12px; }  input {     border-radius: 3px;     border: 2px solid #B5DCF7;     padding-left: 3px; } #email {     width: 160px; }  .radio {     width: 20px; }  #submit {     background-color: #7EC2F2;     height: 32px;     width: 70px;     color: white; }  Form Validation  First Name:  james   Last Name:  greeno   Email:  jimgreeno81@gmail.com   Password:  ••••••••••   Confirm Password:  •••••••••• Passwords match!   Sex:   Male  Female   Quantity:      1    2    3    4    5    6   Interests (select all that apply):  This  That  Other   Hayo!;:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement