Wednesday, 27 March 2019

Code

<html>
<head>
<title>Implimentation</title>
<script type="text/javascript">

function myFunction() {
var fname = document.getElementById("fname").value;
var lname = document.getElementById("lname").value;
var email = document.getElementById("email").value;
var remail = document.getElementById("remail").value;
var password = document.getElementById("password").value;

  //  http://www.randomsnippets.com/2008/04/01/how-to-verify-email-format-via-javascript/

var status = false;   
var emailRegEx = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i;


  var x = document.getElementById("male").checked;
  var y = document.getElementById("female").checked;

  var year1 = document.getElementById("year").value;
  var month1 = document.getElementById("month").value;
  var day1 = document.getElementById("day").value;



if(fname=="")
{
alert("Please Enter First Name");
}

else if(lname=="")
{
alert("Please Enter Last Name");
}
else if(email=="")
{
alert("Please Enter Email");
}
else if (document.myform.email.value.search(emailRegEx) == -1)

          alert("Please enter a valid email address.");
      }
else if(remail=="")
{
alert("Please Enter Re-enter Email");
}

else if(email != remail)
{
alert("Please Check Email");
}
else if(password=="")
{
alert("Please Enter Password");
}
else if (password.length<8) {
alert("Please enter 8 digit password");
}
  else if(day1==0)
  {
  alert("Please select Day")
  }
  else if(month1==0)
  {
  alert("Please select Month")
  }
  else if(year1==0)
  {
  alert("Please select year")
  }
  else if(year1>2003)
  {
  alert("You are not eligible. Age should be above 16...!!!")
  }

else if(x!=true && y!=true)
  {
  alert("gender");
  }
  else
  {

  alert("Name = " + fname + "\n" + "Last Name = " + lname
  + "\n" + "Email = " + email
  + "\n" + "Password = " + password
  + "\n" + "DOB = " + day1 + "-" + month1 + "-" + year1
  );
  }

}

</script>
</head>

<body>

<form name="myform">
<h1>User Registration Form</h1>
<input type="text" placeholder="First Name" id="fname">
<input type="text" placeholder="Last Name" id="lname"><br><br>
<input type="text"  name="email" placeholder="Email" id="email"><br><br>
<input type="text" placeholder="Re-enter Email" id="remail"><br><br>
<input type="password" placeholder="Enter Password" id="password"><br><br>

Birthdate : <br>
<select id="day">
  <option value="0">day</option>
  <option value="1">1</option>
  <option value="2">2</option>
  <option value="3">3</option>
  <option value="4">4</option>
  <option value="5">5</option>
  <option value="6">6</option>
  <option value="7">7</option>
  <option value="8">8</option>
  <option value="9">9</option>
  <option value="10">10</option>
  <option value="11">11</option> 
  <option value="12">12</option>
  <option value="13">13</option>
  <option value="14">14</option>
  <option value="15">15</option>
  <option value="16">16</option>
  <option value="17">17</option>
  <option value="18">18</option>
  <option value="19">19</option>
  <option value="20">20</option>
  <option value="21">21</option>
  <option value="22">22</option>
  <option value="23">23</option> 
  <option value="24">24</option>
  <option value="25">25</option>
  <option value="26">26</option>
  <option value="27">27</option>
  <option value="28">28</option>
  <option value="29">29</option>
  <option value="30">30</option>
  <option value="31">31</option>
</select>


<select id="month">
  <option value="0">Month</option>
  <option value="1">1</option>
  <option value="2">2</option>
  <option value="3">3</option>
  <option value="4">4</option>
  <option value="5">5</option>
  <option value="6">6</option>
  <option value="7">7</option>
  <option value="8">8</option>
  <option value="9">9</option>
  <option value="10">10</option>
  <option value="11">11</option> 
  <option value="12">12</option>
</select>


<select id="year">
  <option value="0">Year</option>
  <option value="1996">1996</option>
  <option value="1997">1997</option>
  <option value="1998">1998</option>
  <option value="1999">1999</option>
  <option value="2000">2000</option>
  <option value="2001">2001</option>
  <option value="2002">2002</option>
  <option value="2003">2003</option>
  <option value="2004">2004</option>
  <option value="2005">2005</option>
  <option value="2006">2006</option>
  <option value="2007">2007</option>
  <option value="2008">2008</option>
  <option value="2009">2009</option>
  <option value="2010">2010</option>
  <option value="2011">2011</option>
  <option value="2012">2012</option>
  <option value="2013">2013</option>
  <option value="2014">2014</option>
  <option value="2015">2015</option>
  <option value="2016">2016</option>
  <option value="2017">2017</option>
  <option value="2018">2018</option>
  <option value="2019">2019</option>
</select>

<br><br>
  <input type="radio" name="gender" id="male" value="male"> Male
  <input type="radio" name="gender" id="female" value="female"> Female<br>

<button type="button" onclick="myFunction()">SignUp</button>

</form>
</body>
</html>

Code

<html>
<head>
<title>Implimentation</title>
<script type="text/javascript">

function myFunction() {
var fname = document.getElementById("fname").value;
var lname = document.getElementById("lname").value;
var email = document.getElementById("email").value;
var remail = document.getElementById("remail").value;
var password = document.getElementById("password").value;

  //  http://www.randomsnippets.com/2008/04/01/how-to-verify-email-format-via-javascript/

var status = false;   
var emailRegEx = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i;


  var x = document.getElementById("male").checked;
  var y = document.getElementById("female").checked;

  var year1 = document.getElementById("year").value;
  var month1 = document.getElementById("month").value;
  var day1 = document.getElementById("day").value;



if(fname=="")
{
alert("Please Enter First Name");
}

else if(lname=="")
{
alert("Please Enter Last Name");
}
else if(email=="")
{
alert("Please Enter Email");
}
else if (document.myform.email.value.search(emailRegEx) == -1)

          alert("Please enter a valid email address.");
      }
else if(remail=="")
{
alert("Please Enter Re-enter Email");
}

else if(email != remail)
{
alert("Please Check Email");
}
else if(password=="")
{
alert("Please Enter Password");
}
else if (password.length<8) {
alert("Please enter 8 digit password");
}
  else if(day1==0)
  {
  alert("Please select Day")
  }
  else if(month1==0)
  {
  alert("Please select Month")
  }
  else if(year1==0)
  {
  alert("Please select year")
  }
  else if(year1>2003)
  {
  alert("You are not eligible. Age should be above 16...!!!")
  }

else if(x!=true && y!=true)
  {
  alert("gender");
  }
  else
  {

  alert("Name = " + fname + "\n" + "Last Name = " + lname
  + "\n" + "Email = " + email
  + "\n" + "Password = " + password
  + "\n" + "DOB = " + day1 + "-" + month1 + "-" + year1
  );
  }

}

</script>
</head>

<body>

<form name="myform">
<h1>User Registration Form</h1>
<input type="text" placeholder="First Name" id="fname">
<input type="text" placeholder="Last Name" id="lname"><br><br>
<input type="text"  name="email" placeholder="Email" id="email"><br><br>
<input type="text" placeholder="Re-enter Email" id="remail"><br><br>
<input type="password" placeholder="Enter Password" id="password"><br><br>

Birthdate : <br>
<select id="day">
  <option value="0">day</option>
  <option value="1">1</option>
  <option value="2">2</option>
  <option value="3">3</option>
  <option value="4">4</option>
  <option value="5">5</option>
  <option value="6">6</option>
  <option value="7">7</option>
  <option value="8">8</option>
  <option value="9">9</option>
  <option value="10">10</option>
  <option value="11">11</option> 
  <option value="12">12</option>
  <option value="13">13</option>
  <option value="14">14</option>
  <option value="15">15</option>
  <option value="16">16</option>
  <option value="17">17</option>
  <option value="18">18</option>
  <option value="19">19</option>
  <option value="20">20</option>
  <option value="21">21</option>
  <option value="22">22</option>
  <option value="23">23</option> 
  <option value="24">24</option>
  <option value="25">25</option>
  <option value="26">26</option>
  <option value="27">27</option>
  <option value="28">28</option>
  <option value="29">29</option>
  <option value="30">30</option>
  <option value="31">31</option>
</select>


<select id="month">
  <option value="0">Month</option>
  <option value="1">1</option>
  <option value="2">2</option>
  <option value="3">3</option>
  <option value="4">4</option>
  <option value="5">5</option>
  <option value="6">6</option>
  <option value="7">7</option>
  <option value="8">8</option>
  <option value="9">9</option>
  <option value="10">10</option>
  <option value="11">11</option> 
  <option value="12">12</option>
</select>


<select id="year">
  <option value="0">Year</option>
  <option value="1996">1996</option>
  <option value="1997">1997</option>
  <option value="1998">1998</option>
  <option value="1999">1999</option>
  <option value="2000">2000</option>
  <option value="2001">2001</option>
  <option value="2002">2002</option>
  <option value="2003">2003</option>
  <option value="2004">2004</option>
  <option value="2005">2005</option>
  <option value="2006">2006</option>
  <option value="2007">2007</option>
  <option value="2008">2008</option>
  <option value="2009">2009</option>
  <option value="2010">2010</option>
  <option value="2011">2011</option>
  <option value="2012">2012</option>
  <option value="2013">2013</option>
  <option value="2014">2014</option>
  <option value="2015">2015</option>
  <option value="2016">2016</option>
  <option value="2017">2017</option>
  <option value="2018">2018</option>
  <option value="2019">2019</option>
</select>

<br><br>
  <input type="radio" name="gender" id="male" value="male"> Male
  <input type="radio" name="gender" id="female" value="female"> Female<br>

<button type="button" onclick="myFunction()">SignUp</button>

</form>
</body>
</html>

Tuesday, 26 March 2019

Home tuntun Bhaiya jk

<!DOCTYPE html>
<html>
 
<head>
 
  
<title>Email validation</title>
 
<style>
body {font-family: Arial, Helvetica, sans-serif;}
* {box-sizing: border-box}

/* Full-width input fields */
input[type=text], input[type=password] {
    width: 100%;
    padding: 15px;
    margin: 5px 0 22px 0;
    display: inline-block;
    border: none;
    background: #f1f1f1;
}

input[type=text]:focus, input[type=password]:focus {
    background-color: #ddd;
    outline: none;
}

hr {
    border: 1px solid #f1f1f1;
    margin-bottom: 25px;
}

/* Set a style for all buttons */
button {
    background-color: #4CAF50;
    color: white;
    padding: 14px 20px;
    margin: 8px 0;
    border: none;
    cursor: pointer;
    width: 100%;
    opacity: 0.9;
}

button:hover {
    opacity:1;
}

/* Extra styles for the cancel button */
.cancelbtn {
    padding: 14px 20px;
    background-color: #f44336;
}

/* Float cancel and signup buttons and add an equal width */
.cancelbtn, .signupbtn {
  float: left;
  width: 20%;
}

/* Add padding to container elements */
.container {
    padding: 16px;
}

/* Clear floats */
.clearfix::after {
    content: "";
    clear: both;
    display: table;
}

/* Change styles for cancel button and signup button on extra small screens */
@media screen and (max-width: 50px) {
    .cancelbtn, .signupbtn {
       width: 50%;
    }
}
 

</style>
<fieldset>
 
<script>
  
function checkEmail(theForm) 
{
   
if (theForm.EMAIL_1.value != theForm.EMAIL_2.value)
   
{
    
alert('Those emails don\'t match!');

    
return false;
   
} else {
    
return true;
   
}
  
}
 


  
</script>
 
</head>
  
<body>

<table align="center">
<tr>
<td>
<h1 align="center">Registration From</h1>
<form action="../" onsubmit="return checkEmail(this);">
  


 
  



    
<input type="text" id="fname" placeholder="FirstName" name="FirstName" required><br/>

    <input type="text" id="lname" placeholder="LastName" name="LastName" required><br/>

    <input type="text" id="email" placeholder="Email" name="EMAIL_1" pattern="[a-z0-9._+%]+@[a-z0-9._]+\.[a-z]{2,}$"><br/>

    <input type="text" placeholder="Re-Email" name="EMAIL_2" pattern="[a-z0-9._+%]+@[a-z0-9._]+\.[a-z]{2,}$"><br/>


    <input type="password" id="psw" placeholder="Password" name="psw" pattern="(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}" title="Must contain at least one number and one uppercase and lowercase letter, 

and at least 8 or more characters" required>

</script>
<br/>
   
  </div>Date of birth<br/>
Day
<select name='day' id='dayddl'>
<option value='1'>1</option>
<option value='2'>2</option>
<option value='3'>3</option>
<option value='4'>4</option>
<option value='5'>5</option>
<option value='6'>6</option>
<option value='7'>7</option>
<option value='8'>8</option>
<option value='9'>9</option>
<option value='10'>10</option>
<option value='11'>11</option>
<option value='12'>12</option>
<option value='13'>13</option>
<option value='14'>14</option>
<option value='15'>15</option>
<option value='16'>16</option>
<option value='17'>17</option>
<option value='18'>18</option>
<option value='19'>19</option>
<option value='20'>20</option>
<option value='21'>21</option>
<option value='22'>22</option>
<option value='23'>23</option>
<option value='24'>24</option>
<option value='25'>25</option>
<option value='26'>26</option>
<option value='27'>27</option>
<option value='28'>28</option>
<option value='29'>29</option>
<option value='30'>30</option>
<option value='31'>31</option>
</select>


Month
<select name='month' id='monthddl'>
<option value='1'>1</option>
<option value='2'>2</option>
<option value='3'>3</option>
<option value='4'>4</option>
<option value='5'>5</option>
<option value='6'>6</option>
<option value='7'>7</option>
<option value='8'>8</option>
<option value='9'>9</option>
<option value='10'>10</option>
<option value='11'>11</option>
<option value='12'>12</option>
</select>

Year

<select name='day' id='blah'>
<option value='1947'>1947</option>
<option value='1948'>1948</option>
<option value='1949'>1949</option>
<option value='1950'>1950</option>
<option value='1951'>1951</option>
<option value='1952'>1952</option>
<option value='1953'>1953</option>
<option value='1954'>1954</option>
<option value='1955'>1955</option>
<option value='1956'>1956</option>
<option value='1957'>1957</option>
<option value='1958'>1958</option>
<option value='1959'>1959</option>
<option value='1960'>1960</option>
<option value='1961'>1961</option>
<option value='1962'>1962</option>
<option value='1963'>1963</option>
<option value='1964'>1964</option>
<option value='1965'>1965</option>
<option value='1966'>1966</option>
<option value='1967'>1967</option>
<option value='1968'>1968</option>
<option value='1969'>1969</option>
<option value='1970'>1970</option>
<option value='1971'>1971</option>
<option value='1972'>1972</option>
<option value='1973'>1973</option>
<option value='1974'>1974</option>
<option value='1975'>1975</option>
<option value='1976'>1976</option>
<option value='1977'>1977</option>
<option value='1978'>1978</option>
<option value='1979'>1979</option>
<option value='1980'>1980</option>
<option value='1981'>1981</option>
<option value='1982'>1982</option>
<option value='1983'>1983</option>
<option value='1984'>1984</option>
<option value='1985'>1985</option>
<option value='1986'>1986</option>
<option value='1987'>1987</option>
<option value='1988'>1988</option>
<option value='1989'>1989</option>
<option value='1990'>1990</option>
<option value='1991'>1991</option>
<option value='1992'>1992</option>
<option value='1993'>1993</option>
</select>

    </div><br/><br/>
GENDER

<input type="radio" name="gender" value="male"> Male
  <input type="radio" name="gender" value="female"> Female<br>
     
<button type="submit" name="submit" onclick="myfunction()">Submit</button> 

  
  
</form>
 

</td></tr></table>
</body>
</fieldset>
 
</html>

Wednesday, 14 November 2018

<!DOCTYPE html>
<html lang="en"><head>
<script>
function formValidation()
{
var uid = document.registration.userid;
var passid = document.registration.passid;
var uname = document.registration.username;
var uadd = document.registration.address;
var ucountry = document.registration.country;
var uzip = document.registration.zip;
var uemail = document.registration.email;
var umsex = document.registration.msex;
var ufsex = document.registration.fsex; if(userid_validation(uid,5,12))
{
if(passid_validation(passid,7,12))
{
if(allLetter(uname))
{
if(alphanumeric(uadd))
{
if(countryselect(ucountry))
{
if(allnumeric(uzip))
{
if(ValidateEmail(uemail))
{
if(validsex(umsex,ufsex))
{
}
}
}
}
}
}
}
}
return false;
} function userid_validation(uid,mx,my)
{
var uid_len = uid.value.length;
if (uid_len == 0 || uid_len >= my || uid_len < mx)
{
alert("User Id should not be empty / length be between "+mx+" to "+my);
uid.focus();
return false;
}
return true;
}
function passid_validation(passid,mx,my)
{
var passid_len = passid.value.length;
if (passid_len == 0 ||passid_len >= my || passid_len < mx)
{
alert("Password should not be empty / length be between "+mx+" to "+my);
passid.focus();
return false;
}
return true;
}
function allLetter(uname)
{
var letters = /^[A-Za-z]+$/;
if(uname.value.match(letters))
{
return true;
}
else
{
alert('Username must have alphabet characters only');
uname.focus();
return false;
}
}
function alphanumeric(uadd)
{
var letters = /^[0-9a-zA-Z]+$/;
if(uadd.value.match(letters))
{
return true;
}
else
{
alert('User address must have alphanumeric characters only');
uadd.focus();
return false;
}
}
function countryselect(ucountry)
{
if(ucountry.value == "Default")
{
alert('Select your country from the list');
ucountry.focus();
return false;
}
else
{
return true;
}
}
function allnumeric(uzip)
{
var numbers = /^[0-9]+$/;
if(uzip.value.match(numbers))
{
return true;
}
else
{
alert('ZIP code must have numeric characters only');
uzip.focus();
return false;
}
}
function ValidateEmail(uemail)
{
var mailformat = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
if(uemail.value.match(mailformat))
{
return true;
}
else
{
alert("You have entered an invalid email address!");
uemail.focus();
return false;
}
} function validsex(umsex,ufsex)
{
x=0;
if(umsex.checked)
{
x++;
} if(ufsex.checked)
{
x++;
}
if(x==0)
{
alert('Select Male/Female');
umsex.focus();
return false;
}
else
{
alert('Form Succesfully Submitted');
window.location.reload()
return true;
}
}
</script>
<meta charset="utf-8">
<title>JavaScript Form Validation using a sample registration form</title>
<meta name="keywords" content="example, JavaScript Form Validation, Sample registration form" />
<meta name="description" content="This document is an example of JavaScript Form Validation using a sample registration form. " />
<link rel='stylesheet' href='js-form-validation.css' type='text/css' />
<script src="sample-registration-form-validation.js"></script>
</head>
<body onload="document.registration.userid.focus();">
<h1>Registration Form</h1>
Use tab keys to move from one input field to the next.
<form name='registration' onSubmit="return formValidation();">
<ul>
<li><label for="userid">User id:</label></li>
<li><input type="text" name="userid" size="12" /></li>
<li><label for="passid">Password:</label></li>
<li><input type="password" name="passid" size="12" /></li>
<li><label for="username">Name:</label></li>
<li><input type="text" name="username" size="50" /></li>
<li><label for="address">Address:</label></li>
<li><input type="text" name="address" size="50" /></li>
<li><label for="country">Country:</label></li>
<li><select name="country">
<option selected="" value="Default">(Please select a country)</option>
<option value="AF">Australia</option>
<option value="AL">Canada</option>
<option value="DZ">India</option>
<option value="AS">Russia</option>
<option value="AD">USA</option>
</select></li>
<li><label for="zip">ZIP Code:</label></li>
<li><input type="text" name="zip" /></li>
<li><label for="email">Email:</label></li>
<li><input type="text" name="email" size="50" /></li>
<li><label id="gender">Sex:</label></li>
<li><input type="radio" name="msex" value="Male" /><span>Male</span></li>
<li><input type="radio" name="fsex" value="Female" /><span>Female</span></li>
<li><label>Language:</label></li>
<li><input type="checkbox" name="en" value="en" checked /><span>English</span></li>
<li><input type="checkbox" name="nonen" value="noen" /><span>Non English</span></li>
<li><label for="desc">About:</label></li>
<li><textarea name="desc" id="desc"></textarea></li>
<li><input type="submit" name="submit" value="Submit" /></li>
</ul>
</form>
</body>
</html>

Code

<html> <head> <title>Implimentation</title> <script type="text/javascript"> fu...