inneedofhelp5599 inneedofhelp5599
  • 18-03-2020
  • Computers and Technology
contestada

Validate that the user age field is between 18 and 100. If valid, set the background of the field to LightGreen and assign true to userAgeValid. Otherwise, set the background to Orange and userAgeValid to false.

Respuesta :

abdullahfarooqi
abdullahfarooqi abdullahfarooqi
  • 22-03-2020

Answer:

function userAgeCheck(event){

   

 // if age is in range 18 to 100

   // parseInt() converts string into integer

   if( parseInt(userAge.value) >= 18 && parseInt(userAge.value) <= 100 ){

       // set color to light green

       document.body.style.backgroundColor = "green";

       

       userAgeValid = true;

   }

   else{

       // set color to orange

       document.body.style.backgroundColor = "orange";

       

       userAgeValid = false;

   }

}

Explanation:

Answer Link

Otras preguntas

Where is the homeland of the Burgundians
What collects blood from other heart chambers
An allegory is a story that uses characters and settings as symbols that carry a deeper meaning beyond the obvious meaning of the story. Which excerpt from Nath
variety of life across the biosphere is called ?
Sally has been dating Terri for nine weeks. She has made a decision to remain abstinent. She talked to Terri about her decision but said it in such a laughing m
9 1/2 gal = ? qt? Im so bad at math!!!
who was the confedrates frist president
What were some important outcomes of the War of 1812? a. Britain remained hopeful it would some day retake its former colonies; Americans kept their sights on
How many millimeters is in 8 liters
The Calvin cycle: produces glucose and water is the second stage of photosynthesis does not require light all of the above