Web Development and Design Foundations with HTML5 (8th Edition)
Web Development and Design Foundations with HTML5 (8th Edition)
8th Edition
ISBN: 9780134322759
Author: Terry Felke-Morris
Publisher: PEARSON
bartleby

Concept explainers

Expert Solution & Answer
Book Icon
Chapter 14.8, Problem 2CP

Explanation of Solution

Program:

<!--HTML Tag-->

<html>

<!--Body Tag-->

<body>

<!--Script Tag-->

<script>

//Declaration of variable

var userAge;

//Prompt the input from user

userAge=prompt("Enter user's Age");

/*Condition to check age*/

if (userAge < 18)

{

/*If true, display the "You are under 18" message*/

alert("You are under 18");

}

//Otherwise

else

{

/*If false, display the "You are 18 or older" message*/

alert("You are 18 or older");

}

//Close the script tag

</script>

<!--Close Tag-->

</body>

<!--Close Tag-->

</html>

Explanation:

  • The HTML tag was included using “<html>”...

Blurred answer
Students have asked these similar questions
What exactly are the events that are available in JavaScript? Create a Script in order to show the onclick event.
Write a java script Program to display an ALERT box using ONCLICK event Write some information about your Favourite TEACHER using <body> element.
What exactly are the events that JavaScript has? Create a Script to show the onclick event in action.
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:9781337508841
Author:Carey
Publisher:Cengage
Text book image
New Perspectives on HTML5, CSS3, and JavaScript
Computer Science
ISBN:9781305503922
Author:Patrick M. Carey
Publisher:Cengage Learning