SlideShare a Scribd company logo
1 of 1
Option #1: Form Validation in JavaScript
1. In your text editor, open the index.htm file from the HandsOnProject6-1 folder in the
Chapter06 folder , add your name and today's date where indicated in the comment section, and
then save the file. 2. Create a new document in your editor, add JavaScript comments containing
the text Hands-on Project6-1, your name, and today's date, and then save the file to the
HandsOnProject6-1 folder with the name script.js. 3. Return to the htm file in your browser,
within the body section, just before the closing /body tag, add a script element, and then specify
the file script.js as the source. 4. In the opening form tag, add code to disable browser-based
validation, and then save your changes. 5. In the script.js file, add code instructing processors to
interpret the contents in strict mode, and then create a global variable named formValidity and
set its value to true. 6. Add the following function to validate the required form elements: 7. Add
the following function to create an event lister for the submit event. 8. Add the following
function to trigger validation of required fields when the Submit button is clicked: 9. Add the
following code to call the createEventListeners() function when the page finishes loading. 1 /*
run setup functions when page finishes loading */ 2 if (window.addEventListner) { 3
window.addEventListner("load", createEventListenres, false); 4 } else if (window.attachEvent)
{ 5 window.attachEvent ("onload", createEventListeners); 6 } 10. Save your changes to
script.js, open index.htm in a browser, and then test various combinations of invalid and valid
data to ensure that the scripts you wrote behave as you expect. Debug your code as necessary
until it functions correctly. 11. Returntoscript.js in your editor, and then add the following
function to validate input elements with the number type: 1/ validate number fields for older
browsers % 2 function validate Numbers () { 3 var numberInputs = document.querySelectorAll
(H"#contactinfo input[type=number]"); 4 var elementCount = numberInputs.length; 5 var
numErrorDiv = document.getElementByld("numErrorText"); 6 var numbersValidity = true; 7
var currentElement; 8 try { 12. In the validateForm() function, add a call to the
validateNumbers() function as follows: 13. Save your changes to script.js, open index.htm in a
browser, and then test various combinations of invalid and valid data, including nonnumeric
entries in number fields, to ensure that the scripts you wrote behave as you expect. Debug your
code as necessary until it functions correctly.

More Related Content

Similar to Option #1- Form Validation in JavaScript 1- In your text editor- open.docx

Prep 2-booklet-2nd-term-2016-2017
Prep 2-booklet-2nd-term-2016-2017Prep 2-booklet-2nd-term-2016-2017
Prep 2-booklet-2nd-term-2016-2017khawagah
 
Java Web Programming [8/9] : JSF and AJAX
Java Web Programming [8/9] : JSF and AJAXJava Web Programming [8/9] : JSF and AJAX
Java Web Programming [8/9] : JSF and AJAXIMC Institute
 
02 asp.net session02
02 asp.net session0202 asp.net session02
02 asp.net session02Mani Chaubey
 
Django 1.10.3 Getting started
Django 1.10.3 Getting startedDjango 1.10.3 Getting started
Django 1.10.3 Getting startedMoniaJ
 
Drag & drop calendar javaScript add-in for dynamics nav
Drag & drop calendar javaScript add-in for dynamics navDrag & drop calendar javaScript add-in for dynamics nav
Drag & drop calendar javaScript add-in for dynamics navMehdi Meddah
 
User controls
User controlsUser controls
User controlsaspnet123
 
Previous weeks work has been uploaded as well as any other pieces ne.docx
Previous weeks work has been uploaded as well as any other pieces ne.docxPrevious weeks work has been uploaded as well as any other pieces ne.docx
Previous weeks work has been uploaded as well as any other pieces ne.docxkeilenettie
 
How to Integrate Internet of Things with Webserver with
How to Integrate Internet of Things with Webserver with How to Integrate Internet of Things with Webserver with
How to Integrate Internet of Things with Webserver with Ionela
 
Introduction to the INTEGRAL FRAMEWORK
Introduction to the INTEGRAL FRAMEWORKIntroduction to the INTEGRAL FRAMEWORK
Introduction to the INTEGRAL FRAMEWORKKarthik Subramanian
 
Introduction to the integral framework
Introduction to the integral frameworkIntroduction to the integral framework
Introduction to the integral frameworkKarthik Subramanian
 
Local Notification Tutorial
Local Notification TutorialLocal Notification Tutorial
Local Notification TutorialKetan Raval
 
My Very First Zf App Part One
My Very First Zf App   Part OneMy Very First Zf App   Part One
My Very First Zf App Part Oneisaaczfoster
 
Micro services from scratch - Part 1
Micro services from scratch - Part 1Micro services from scratch - Part 1
Micro services from scratch - Part 1Azrul MADISA
 

Similar to Option #1- Form Validation in JavaScript 1- In your text editor- open.docx (20)

Prep 2-booklet-2nd-term-2016-2017
Prep 2-booklet-2nd-term-2016-2017Prep 2-booklet-2nd-term-2016-2017
Prep 2-booklet-2nd-term-2016-2017
 
ASP.NET - Web Programming
ASP.NET - Web ProgrammingASP.NET - Web Programming
ASP.NET - Web Programming
 
Java Web Programming [8/9] : JSF and AJAX
Java Web Programming [8/9] : JSF and AJAXJava Web Programming [8/9] : JSF and AJAX
Java Web Programming [8/9] : JSF and AJAX
 
02 asp.net session02
02 asp.net session0202 asp.net session02
02 asp.net session02
 
Django 1.10.3 Getting started
Django 1.10.3 Getting startedDjango 1.10.3 Getting started
Django 1.10.3 Getting started
 
Javascript projects Course
Javascript projects CourseJavascript projects Course
Javascript projects Course
 
Asp.net tips
Asp.net tipsAsp.net tips
Asp.net tips
 
Drag & drop calendar javaScript add-in for dynamics nav
Drag & drop calendar javaScript add-in for dynamics navDrag & drop calendar javaScript add-in for dynamics nav
Drag & drop calendar javaScript add-in for dynamics nav
 
User controls
User controlsUser controls
User controls
 
Previous weeks work has been uploaded as well as any other pieces ne.docx
Previous weeks work has been uploaded as well as any other pieces ne.docxPrevious weeks work has been uploaded as well as any other pieces ne.docx
Previous weeks work has been uploaded as well as any other pieces ne.docx
 
How to Integrate Internet of Things with Webserver with
How to Integrate Internet of Things with Webserver with How to Integrate Internet of Things with Webserver with
How to Integrate Internet of Things with Webserver with
 
Introduction to the INTEGRAL FRAMEWORK
Introduction to the INTEGRAL FRAMEWORKIntroduction to the INTEGRAL FRAMEWORK
Introduction to the INTEGRAL FRAMEWORK
 
Introduction to the integral framework
Introduction to the integral frameworkIntroduction to the integral framework
Introduction to the integral framework
 
Local Notification Tutorial
Local Notification TutorialLocal Notification Tutorial
Local Notification Tutorial
 
Web forms in ASP.net
Web forms in ASP.netWeb forms in ASP.net
Web forms in ASP.net
 
70562 (1)
70562 (1)70562 (1)
70562 (1)
 
My Very First Zf App Part One
My Very First Zf App   Part OneMy Very First Zf App   Part One
My Very First Zf App Part One
 
2310 b 05
2310 b 052310 b 05
2310 b 05
 
Micro services from scratch - Part 1
Micro services from scratch - Part 1Micro services from scratch - Part 1
Micro services from scratch - Part 1
 
Ddpz2613 topic9 java
Ddpz2613 topic9 javaDdpz2613 topic9 java
Ddpz2613 topic9 java
 

More from farrahkur54

PARTICIPANTS PROFILE ANSWER ABOVE MENTIONED QUESTIONS BY TAKING CARE.docx
PARTICIPANTS PROFILE  ANSWER ABOVE MENTIONED QUESTIONS  BY TAKING CARE.docxPARTICIPANTS PROFILE  ANSWER ABOVE MENTIONED QUESTIONS  BY TAKING CARE.docx
PARTICIPANTS PROFILE ANSWER ABOVE MENTIONED QUESTIONS BY TAKING CARE.docxfarrahkur54
 
Part3- Offline traffic monitoring In this part will use a PCAP file to.docx
Part3- Offline traffic monitoring In this part will use a PCAP file to.docxPart3- Offline traffic monitoring In this part will use a PCAP file to.docx
Part3- Offline traffic monitoring In this part will use a PCAP file to.docxfarrahkur54
 
Participation is a requirement of this course- Students provide one po.docx
Participation is a requirement of this course- Students provide one po.docxParticipation is a requirement of this course- Students provide one po.docx
Participation is a requirement of this course- Students provide one po.docxfarrahkur54
 
Partners Johnny and Daniel each have capital balances of $95-000- Migu.docx
Partners Johnny and Daniel each have capital balances of $95-000- Migu.docxPartners Johnny and Daniel each have capital balances of $95-000- Migu.docx
Partners Johnny and Daniel each have capital balances of $95-000- Migu.docxfarrahkur54
 
Parthians- write one to two paragraphs on the significance of this ite.docx
Parthians- write one to two paragraphs on the significance of this ite.docxParthians- write one to two paragraphs on the significance of this ite.docx
Parthians- write one to two paragraphs on the significance of this ite.docxfarrahkur54
 
Overview You are required to prepare a Data Entry report which provide.docx
Overview You are required to prepare a Data Entry report which provide.docxOverview You are required to prepare a Data Entry report which provide.docx
Overview You are required to prepare a Data Entry report which provide.docxfarrahkur54
 
package edu-ser222-m03_02- --- - A binary search tree based impleme.docx
package edu-ser222-m03_02-   ---  - A binary search tree based impleme.docxpackage edu-ser222-m03_02-   ---  - A binary search tree based impleme.docx
package edu-ser222-m03_02- --- - A binary search tree based impleme.docxfarrahkur54
 
P(A)+P(A)-1 is one way to express the P(A)+P(A)-1 is one way to expres.docx
P(A)+P(A)-1 is one way to express the P(A)+P(A)-1 is one way to expres.docxP(A)+P(A)-1 is one way to express the P(A)+P(A)-1 is one way to expres.docx
P(A)+P(A)-1 is one way to express the P(A)+P(A)-1 is one way to expres.docxfarrahkur54
 
Overton Company has gathered the following information-Compute equival.docx
Overton Company has gathered the following information-Compute equival.docxOverton Company has gathered the following information-Compute equival.docx
Overton Company has gathered the following information-Compute equival.docxfarrahkur54
 
Over 1 million Americans make a living working for advertising and pub.docx
Over 1 million Americans make a living working for advertising and pub.docxOver 1 million Americans make a living working for advertising and pub.docx
Over 1 million Americans make a living working for advertising and pub.docxfarrahkur54
 
Oscar is suing John for $1000 dollars but the judge sees that their ar.docx
Oscar is suing John for $1000 dollars but the judge sees that their ar.docxOscar is suing John for $1000 dollars but the judge sees that their ar.docx
Oscar is suing John for $1000 dollars but the judge sees that their ar.docxfarrahkur54
 
Organizational Behavior Chapter 5 - Perception and Indigidual Decision.docx
Organizational Behavior Chapter 5 - Perception and Indigidual Decision.docxOrganizational Behavior Chapter 5 - Perception and Indigidual Decision.docx
Organizational Behavior Chapter 5 - Perception and Indigidual Decision.docxfarrahkur54
 
ook at the mean- median- mode- and standard deviation and describe how.docx
ook at the mean- median- mode- and standard deviation and describe how.docxook at the mean- median- mode- and standard deviation and describe how.docx
ook at the mean- median- mode- and standard deviation and describe how.docxfarrahkur54
 
Option #1- Creating a GUI Bank Balance Application Create a simple Gr.docx
Option #1-  Creating a GUI Bank Balance Application Create a simple Gr.docxOption #1-  Creating a GUI Bank Balance Application Create a simple Gr.docx
Option #1- Creating a GUI Bank Balance Application Create a simple Gr.docxfarrahkur54
 
Operational Metrics and Benchmarking in Healthcare- What are common op.docx
Operational Metrics and Benchmarking in Healthcare- What are common op.docxOperational Metrics and Benchmarking in Healthcare- What are common op.docx
Operational Metrics and Benchmarking in Healthcare- What are common op.docxfarrahkur54
 
One of the duties and functions of the joint OHS committee is to ensur.docx
One of the duties and functions of the joint OHS committee is to ensur.docxOne of the duties and functions of the joint OHS committee is to ensur.docx
One of the duties and functions of the joint OHS committee is to ensur.docxfarrahkur54
 
One of the deadliest heart conditions is a disturbance in heart rhythm.docx
One of the deadliest heart conditions is a disturbance in heart rhythm.docxOne of the deadliest heart conditions is a disturbance in heart rhythm.docx
One of the deadliest heart conditions is a disturbance in heart rhythm.docxfarrahkur54
 
Once you have all the structures working as intended- it is time to co.docx
Once you have all the structures working as intended- it is time to co.docxOnce you have all the structures working as intended- it is time to co.docx
Once you have all the structures working as intended- it is time to co.docxfarrahkur54
 

More from farrahkur54 (20)

PARTICIPANTS PROFILE ANSWER ABOVE MENTIONED QUESTIONS BY TAKING CARE.docx
PARTICIPANTS PROFILE  ANSWER ABOVE MENTIONED QUESTIONS  BY TAKING CARE.docxPARTICIPANTS PROFILE  ANSWER ABOVE MENTIONED QUESTIONS  BY TAKING CARE.docx
PARTICIPANTS PROFILE ANSWER ABOVE MENTIONED QUESTIONS BY TAKING CARE.docx
 
Part3- Offline traffic monitoring In this part will use a PCAP file to.docx
Part3- Offline traffic monitoring In this part will use a PCAP file to.docxPart3- Offline traffic monitoring In this part will use a PCAP file to.docx
Part3- Offline traffic monitoring In this part will use a PCAP file to.docx
 
Participation is a requirement of this course- Students provide one po.docx
Participation is a requirement of this course- Students provide one po.docxParticipation is a requirement of this course- Students provide one po.docx
Participation is a requirement of this course- Students provide one po.docx
 
Partners Johnny and Daniel each have capital balances of $95-000- Migu.docx
Partners Johnny and Daniel each have capital balances of $95-000- Migu.docxPartners Johnny and Daniel each have capital balances of $95-000- Migu.docx
Partners Johnny and Daniel each have capital balances of $95-000- Migu.docx
 
Parthians- write one to two paragraphs on the significance of this ite.docx
Parthians- write one to two paragraphs on the significance of this ite.docxParthians- write one to two paragraphs on the significance of this ite.docx
Parthians- write one to two paragraphs on the significance of this ite.docx
 
P(X-x).docx
P(X-x).docxP(X-x).docx
P(X-x).docx
 
Overview You are required to prepare a Data Entry report which provide.docx
Overview You are required to prepare a Data Entry report which provide.docxOverview You are required to prepare a Data Entry report which provide.docx
Overview You are required to prepare a Data Entry report which provide.docx
 
package edu-ser222-m03_02- --- - A binary search tree based impleme.docx
package edu-ser222-m03_02-   ---  - A binary search tree based impleme.docxpackage edu-ser222-m03_02-   ---  - A binary search tree based impleme.docx
package edu-ser222-m03_02- --- - A binary search tree based impleme.docx
 
P(A)+P(A)-1 is one way to express the P(A)+P(A)-1 is one way to expres.docx
P(A)+P(A)-1 is one way to express the P(A)+P(A)-1 is one way to expres.docxP(A)+P(A)-1 is one way to express the P(A)+P(A)-1 is one way to expres.docx
P(A)+P(A)-1 is one way to express the P(A)+P(A)-1 is one way to expres.docx
 
P(Z-0-86).docx
P(Z-0-86).docxP(Z-0-86).docx
P(Z-0-86).docx
 
Overton Company has gathered the following information-Compute equival.docx
Overton Company has gathered the following information-Compute equival.docxOverton Company has gathered the following information-Compute equival.docx
Overton Company has gathered the following information-Compute equival.docx
 
Over 1 million Americans make a living working for advertising and pub.docx
Over 1 million Americans make a living working for advertising and pub.docxOver 1 million Americans make a living working for advertising and pub.docx
Over 1 million Americans make a living working for advertising and pub.docx
 
Oscar is suing John for $1000 dollars but the judge sees that their ar.docx
Oscar is suing John for $1000 dollars but the judge sees that their ar.docxOscar is suing John for $1000 dollars but the judge sees that their ar.docx
Oscar is suing John for $1000 dollars but the judge sees that their ar.docx
 
Organizational Behavior Chapter 5 - Perception and Indigidual Decision.docx
Organizational Behavior Chapter 5 - Perception and Indigidual Decision.docxOrganizational Behavior Chapter 5 - Perception and Indigidual Decision.docx
Organizational Behavior Chapter 5 - Perception and Indigidual Decision.docx
 
ook at the mean- median- mode- and standard deviation and describe how.docx
ook at the mean- median- mode- and standard deviation and describe how.docxook at the mean- median- mode- and standard deviation and describe how.docx
ook at the mean- median- mode- and standard deviation and describe how.docx
 
Option #1- Creating a GUI Bank Balance Application Create a simple Gr.docx
Option #1-  Creating a GUI Bank Balance Application Create a simple Gr.docxOption #1-  Creating a GUI Bank Balance Application Create a simple Gr.docx
Option #1- Creating a GUI Bank Balance Application Create a simple Gr.docx
 
Operational Metrics and Benchmarking in Healthcare- What are common op.docx
Operational Metrics and Benchmarking in Healthcare- What are common op.docxOperational Metrics and Benchmarking in Healthcare- What are common op.docx
Operational Metrics and Benchmarking in Healthcare- What are common op.docx
 
One of the duties and functions of the joint OHS committee is to ensur.docx
One of the duties and functions of the joint OHS committee is to ensur.docxOne of the duties and functions of the joint OHS committee is to ensur.docx
One of the duties and functions of the joint OHS committee is to ensur.docx
 
One of the deadliest heart conditions is a disturbance in heart rhythm.docx
One of the deadliest heart conditions is a disturbance in heart rhythm.docxOne of the deadliest heart conditions is a disturbance in heart rhythm.docx
One of the deadliest heart conditions is a disturbance in heart rhythm.docx
 
Once you have all the structures working as intended- it is time to co.docx
Once you have all the structures working as intended- it is time to co.docxOnce you have all the structures working as intended- it is time to co.docx
Once you have all the structures working as intended- it is time to co.docx
 

Recently uploaded

Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...anjaliyadav012327
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxShobhayan Kirtania
 

Recently uploaded (20)

Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptx
 

Option #1- Form Validation in JavaScript 1- In your text editor- open.docx

  • 1. Option #1: Form Validation in JavaScript 1. In your text editor, open the index.htm file from the HandsOnProject6-1 folder in the Chapter06 folder , add your name and today's date where indicated in the comment section, and then save the file. 2. Create a new document in your editor, add JavaScript comments containing the text Hands-on Project6-1, your name, and today's date, and then save the file to the HandsOnProject6-1 folder with the name script.js. 3. Return to the htm file in your browser, within the body section, just before the closing /body tag, add a script element, and then specify the file script.js as the source. 4. In the opening form tag, add code to disable browser-based validation, and then save your changes. 5. In the script.js file, add code instructing processors to interpret the contents in strict mode, and then create a global variable named formValidity and set its value to true. 6. Add the following function to validate the required form elements: 7. Add the following function to create an event lister for the submit event. 8. Add the following function to trigger validation of required fields when the Submit button is clicked: 9. Add the following code to call the createEventListeners() function when the page finishes loading. 1 /* run setup functions when page finishes loading */ 2 if (window.addEventListner) { 3 window.addEventListner("load", createEventListenres, false); 4 } else if (window.attachEvent) { 5 window.attachEvent ("onload", createEventListeners); 6 } 10. Save your changes to script.js, open index.htm in a browser, and then test various combinations of invalid and valid data to ensure that the scripts you wrote behave as you expect. Debug your code as necessary until it functions correctly. 11. Returntoscript.js in your editor, and then add the following function to validate input elements with the number type: 1/ validate number fields for older browsers % 2 function validate Numbers () { 3 var numberInputs = document.querySelectorAll (H"#contactinfo input[type=number]"); 4 var elementCount = numberInputs.length; 5 var numErrorDiv = document.getElementByld("numErrorText"); 6 var numbersValidity = true; 7 var currentElement; 8 try { 12. In the validateForm() function, add a call to the validateNumbers() function as follows: 13. Save your changes to script.js, open index.htm in a browser, and then test various combinations of invalid and valid data, including nonnumeric entries in number fields, to ensure that the scripts you wrote behave as you expect. Debug your code as necessary until it functions correctly.