answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Novosadov [1.4K]
1 year ago
13

Validate that the user age field is at least 21 and at most 35. If valid, set the background of the field to LightGreen and assi

gn true to userAgeValid. Otherwise, set the background to Orange and userAgeValid to false.HTML JavaScript 1 var validColor-"LightGreen"; 2 var invalidColor"Orange" 3 var userAgeInput -document.getElementByIdC"userAge"); 4 var formWidget -document.getElementByIdC"userForm"); 5 var userAgeValid - false; 7 function userAgeCheck(event) 10 11 function formCheck(event) 12 if (luserAgeValid) { 13 14 15 16 17 userAgeInput.addEventListener("input", userAgeCheck); 18 formWidget.addEventListener('submit', formCheck); event.preventDefault); 3 Check Iry again
Computers and Technology
1 answer:
madam [21]1 year ago
6 0

Answer:

Explanation:

The code provided had many errors. I fixed the errors and changed the userAgeCheck function as requested. Checking the age of that the user has passed as an input and changing the variables as needed depending on the age. The background color that was changed was for the form field as the question was not very specific on which field needed to be changed. The piece of the code that was created can be seen in the attached image below.

var validColor = "LightGreen";

var invalidColor = "Orange";

var userAgeInput = document.getElementById("userAge");

var formWidget = document.getElementById("userForm");

var userAgeValid = false;

function userAgeCheck(event) {

   if ((userAgeInput >= 25) && (userAgeInput <= 35)) {

       document.getElementById("userForm").style.backgroundColor = validColor;

       userAgeValid = true;

   } else {

       document.getElementById("userForm").style.backgroundColor = invalidColor;

       userAgeValid = false;

   }

};

function formCheck(event) {};

if (!userAgeValid) {

   userAgeInput.addEventListener("input", userAgeCheck);

   formWidget.addEventListener('submit', formCheck);  

   event.preventDefault();

}

You might be interested in
Assume that name has been declared suitably for storing names (like "Misha", "Emily" and "Sofia") Write some code that reads a v
dlinn [17]

Answer:

void main(){

string name;

cout<<"Enter Name";

cin>>name;

cout<<"Greetings   " ;

cout<<name;

}

Explanation:

in main function we declared a variable called "name" .using cin we are reading the value into name  and we are printing that name using  cout.

3 0
2 years ago
A drive is small enough to be carried in one's pocket.
hjlf

Answer: Pen

Explanation:

4 0
1 year ago
A simplified main program used to test functions is called
padilas [110]
<span>A simplified main program used to test functions is called <u><em>formula</em></u>
</span><span />
8 0
2 years ago
3. Of the following pieces of information in a document, for which would you most likely insert a mail merge field? A. First nam
yuradex [85]
I would suggest the answer would be both A and D, mail merge is used to specify different field for different recipients. 
4 0
1 year ago
Read 2 more answers
Which are technical and visual demands that need to be considered when planning a project? Choose three answers
iren [92.7K]

Answer: Resolution or DPI, deliverables, and file types are important technical and visual demands to consider when planning a project.

Explanation: Keep in mind whether or not the project will be published in print or on the Web.

4 0
2 years ago
Other questions:
  • U.S. industries like steel, computers, and energy need to be protected from foreign competition to ensure which of the following
    6·2 answers
  • Write a program that can convert an integer between 0 and 15 into hex number (including 0 and 15). the user enters an integer fr
    15·1 answer
  • If you have long column labels with columns so wide that they affect the readability of a worksheet, you should first
    7·1 answer
  • An electronics store purchased a CD player at a wholesale price of $60 and then sold it at a 40 percent discount off the origina
    13·1 answer
  • What is the value of x after each of the following statements is encountered in a computer program, if x=1 before the statement
    9·1 answer
  • Assuming that the valid cost should be between 100 and 200, does the following code snippet test this condition correctly?
    10·1 answer
  • Using Amdahl’s Law, calculate the speedup gain of an application that has a 60 percent parallel component for (a) two processing
    11·1 answer
  • In this problem, we want to compare the computational performance of symmetric and asymmetric algorithms. Assume a fast public-k
    11·1 answer
  • Exercise 4: Bring in program grades.cpp and grades.txt from the Lab 10 folder. Fill in the code in bold so that the data is prop
    12·1 answer
  • If Maya wants to access a view that would control multiple slides within a presentation, which view should she utilize? Master v
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!