Create an HTML file named \"Exercise 5.html\" (or.htm). The page title must be y
ID: 3670648 • Letter: C
Question
Create an HTML file named "Exercise 5.html" (or.htm). The page title must be your name followed by "Exercise 5" (no quotes). The HTML file must contain JavaScript code that gets input from the user and uses the input to build sentences and display them m the Web page. The HTML file must contain JavaScript code that gets input from the user and uses the input to build sentences and display them in the Web page. User input will include the name and age of a subject (a person) in addition to a character (M or F) to indicate the subject's gender. Output will have this form: [Name] is [age] years old. In two years, [he/she] will be (new age) years old. where [Name] is replaced by the input name; [he/she] is replaced by either "he" or "she," depending on whether the gender input is M or F; and [new age] is replaced by a number that is 2 more than the input age. Use multi way selection to determine the pronoun value. If the gender symbol is not M or F, given an error message (alert) that includes the input value; then use "he or she" for the pronoun. Only one document, write may be used - after the end of the multi-way selection.Explanation / Answer
<html>
<head>
<tiitle>Exercise</title>
<script>
var name= prompt("enter your name", "");
var age= prompt("enter your age", "");
var gen= prompt("enter you gender F:female and M:male", "");
var newAge= age+2;
if(gen !=NULL)
{
if(gen =="M" || gen== "m")
var gender= he;
else
gender =she;
document.getElementById("Hello").innerHTML= name+"is"+age+"years old. In two years"+ gender+"will be"+newAge+"years old";
}
</script>
</head>
<body>
<b><i> <h1>"Welcome to Exerice 1"</h1></i></b>
</body>
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.