Posts

Showing posts from November 21, 2016

JavaScript code for a simple form VALIDATION

JavaScript code  for a simple form VALIDATION <html>       <head>       <title> Form Validation </title>              <script type = "text/javascript" > function validate ()       {          if ( document . myForm . Name . value == "" )          {             alert ( "Please provide your name!" );             document . myForm . Name . focus () ;             return false ;          }           if ( document . myForm . EMail . value == "" )     ...

JavaScript code for email validation

JavaScript codes  for email validation <script type = "text/javascript" >    <!--       function validateEmail ()       {          var emailID = document . myForm . EMail . value ;          atpos = emailID . indexOf ( "@" );          dotpos = emailID . lastIndexOf ( "." );                   if ( atpos < 1 || ( dotpos - atpos < 2 ))           {             alert ( "Please enter correct email ID" )             document . myForm . EMail . focus () ;             return fal...

JavaScript code to show how to use a throw statement

JavaScript code to show how to use a throw statement . <html>       <head>        <script type = "text/javascript" >          <!--             function myFunc ()             {                var a = 100 ;                var b = 0 ;                  try {                   if ( b == 0 ){                      throw ( "Divide by z...