Given the starting code in the box below, create an HTML page that has the following form fields, and use JS functions to validate these fields - first name - last name -password - confirm password - email address Valid: No fields must be empty. Password input is equal to Confirm password. Email follows proper syntax ( usemame[at]domainname[dot]domain). If all these fields are valid, greet the user with a prompt or with a header displaying their first and last name Invalid: If any of the fields are invalid, highlight the form fields by changing the background color to red. here is starting code: JavaScript Can Validate Input Please input a number between 1 and 10: Submit

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

JavaScript

Given the starting code in the box below, create an HTML page that has the following
form fields, and use JS functions to validate these fields
- first name
- last name
-password
- confirm password
- email address
Valid: No fields must be empty. Password input is equal to Confirm password. Email follows proper syntax (
username[at]domainname[dot]domain). If all these fields are valid, greet the user with a prompt or with a
header displaying their first and last name
Invalid: If any of the fields are invalid, highlight the form fields by changing the background color to red.
here is starting code:
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript Can Validate Input</h2>
<p>Please input a number between 1 and 10:</p>
<input id="numb">
<button_type="button" onclick="myFunction ()">Submit</button>
<p id="demo"></p>
<script>
function myFunction () {
}
var x, text;
// Get the value of the input field with id="numb"
x = document.getElementById("numb").value;
// If x is Not a Number or less than one or greater than 10
if (isNaN (x) || x < 1 || x > 10) {
text = "Input not valid";
} else {
}
text = "Input OK";
document.getElementById("demo").innerHTML = text;
</script>
</body>
</html>
Transcribed Image Text:Given the starting code in the box below, create an HTML page that has the following form fields, and use JS functions to validate these fields - first name - last name -password - confirm password - email address Valid: No fields must be empty. Password input is equal to Confirm password. Email follows proper syntax ( username[at]domainname[dot]domain). If all these fields are valid, greet the user with a prompt or with a header displaying their first and last name Invalid: If any of the fields are invalid, highlight the form fields by changing the background color to red. here is starting code: <!DOCTYPE html> <html> <body> <h2>JavaScript Can Validate Input</h2> <p>Please input a number between 1 and 10:</p> <input id="numb"> <button_type="button" onclick="myFunction ()">Submit</button> <p id="demo"></p> <script> function myFunction () { } var x, text; // Get the value of the input field with id="numb" x = document.getElementById("numb").value; // If x is Not a Number or less than one or greater than 10 if (isNaN (x) || x < 1 || x > 10) { text = "Input not valid"; } else { } text = "Input OK"; document.getElementById("demo").innerHTML = text; </script> </body> </html>
Expert Solution
steps

Step by step

Solved in 4 steps with 4 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY