ExpertRating - Online Certification and Employment Testing ExpertRating - Online Certification and Employment Testing ExpertRating - Online Certification and Employment Testing

ExpertRating Home
ExpertRating Benefits
Recommend ExpertRating
Suggest More Tests
Privacy Policy
FAQ
Login
 
JavaScript Tutorial - Index
JavaScript Tutorial - Introduction to JavaScript
JavaScript Tutorial - Basic JavaScript Concepts
JavaScript Tutorial - Working with Operators and Variables
JavaScript Tutorial - How to work with Loops and Functions?
JavaScript Tutorial - How to work with Forms and Events?
JavaScript Tutorial - How to work with Objects?
JavaScript Tutorial - How to work with Browsers and Cookies?
JavaScript Tutorial - More about Objects
JavaScript Tutorial - How to validate Forms with JavaScript?
JavaScript Tutorial - Advanced Techniques in JavaScript
     

 
Online Personal Trainer Certification
Personal Trainer Certification (Spanish)
Six Sigma Certification
Find a Personal Trainer
Project Management Certification
Six Sigma Certification
Six Sigma Black Belt Certification
Master Black Belt Certification
Six Sigma Green Belt Certification
Life Coach Certification
Lean Management Certification
Lean Six Sigma Certification
First Aid Certification
CPR Certification
Yoga Certification
Aerobics Certification
Pilates Certification
Business Analyst Certification
SEO Certification
Online Business Writing Course & Certification
Makeup Artist Certification
Baby Sitting Course & Certification
Time Management Certification
Health Club Management Certification
Medical Coding Certification
Medical Billing Certification
Business Analysis Course
Master Trainer Certification
Total Quality Management Certification
Kaizen Certification
Creative Writing Certification
Event Management Certification
Test Search by Job Title
Administrative Assistant Certification
Virtual Assistant Certification
  All Online Courses
   

   
   
   
   
   
   

   
  Home > Courses, Tutorials & eBooks > JavaScript Tutorial > More about Objects
 

JavaScript Tutorial - More about Objects

 
Page 2 of 2
 
Example
function mod10( cardNumber )
{
           var clen = new Array( cardNumber.length );
           var n = 0,sum = 0;
           for( n = 0; n < cardNumber.length; ++n )
          {
                      clen [n] = parseInt ( cardNumber.charAt(n) );
          }
          for( n = clen.length -2; n >= 0; n-=2 )
                      clen [n] *= 2;
          if( clen [n] > 9 )
                      clen [n]-=9;
}
for( n = 0; n < clen.length; ++n )
{
          sum += clen [n];
}
return(((sum%10)==0)?true : false);

 

 
Summary
 

In this chapter you have learnt:

  • Adding interaction in a web page using the form object.
  • Accessing properties and methods of the form object.
  • How to check that no fields remain empty.
  • Validating an email form.
  • Validating if a credit card number is valid or not.

 

 
Review Questions
 

Fill in the Blanks

  1. The ------- object allows you to access elements of a form.
  2. -------- and -------- are two methods of Form object.
  3. Form is a property of ----------- object.
  4. --------- property specifes the number of elements defined in the form.

Solutions

  1. Form
  2. Reset and Submit
  3. Document
  4. Length
Exercise
  1. Empty-fields validation, check whether an Id and Password are filled out or not.
  2. Check whether a valid email id has been submitted or not; E-mail validation.

 

Solution
  1. View Code         View Runtime
  2. View Code         View Runtime

 

 

 
What's Next

The next chapter will acquaint you with the advanced techniques in JavaScript, which includes Image map and Timing events. The chapter will further elucidate about the usage of area object to implement image map.
                  Hop over to the next chapter to get the close-up of image map and timing events.        

       

 

 
     
Home  |  About Us  |  Privacy Policy  |  Site Map  |  FAQs  |  Contact Us
 
© ExpertRating 2015. All Rights Reserved.