Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Here\'s my HTML/Javascript code that I can\'t get to act right. Here\'s what I n

ID: 3544117 • Letter: H

Question

Here's my HTML/Javascript code that I can't get to act right.  Here's what I need it to do:


the area listed in the comment section below is supposed to be written under the button, but ONLY after a number is entered into the box that comes up after the button is pressed.  At this point, I can't get anything to come up at all.  Ugh.....



<!DOCTYPE html>

<html lang="en">


<head>

<meta charset="UTF-8">

<link rel="stylesheet" href="style.css">


<title>Ernest Tee's Soccer Ticket Price</title>

<script type="text/javascript">

var age;

function getAge()

{ age=prompt("Enter Customer's Age");

document.getElementById("customerAge").innerHTML=age;

if (age<5)

{ document.write("Cost of Ernest's ticket is $2.00");} //**********THIS IS WHAT I'M TALKING ABOUT

else if (age>=5 && age<=15)

{document.write("Cost of Ernest's ticket is $6.00");}//**********THIS IS WHAT I'M TALKING ABOUT

else if (age>15)

{document.write("Cost of Ernest's ticket is $8.00");}//**********THIS IS WHAT I'M TALKING ABOUT

}

</script>


</head>


<body>

<header>

<h1>Ernest Tee's Soccer Ticket Price</h1>

</header>

<p>This page will decide the cost of Ernest Tee's soccer ticket price based on his age.</p>

<p><h3>Click on the button below to enter Ernest's age</h3></p>

<div id="container1">

<ul>

<li>Under age 5 (age &lt; 5) cost is $2.00 </li>

<li>Between ages 5 and 15 (5 &ge; age &le; 15) cost is $6.00</li>

<li>Older than 15 (age &gt; 15) cost is $8.00</li>

</ul>

<p><input type="button" value="Enter Ernest's Age"></p>

<p></p>

<br>



</div>

</body>

</html>

Explanation / Answer

Have fun friend & rate it .. Document.write should be replaced as it will redirect to next page to show result


Now check below code & any doubts do ask again



<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

<link rel="stylesheet" href="style.css">

<title>Ernest Tee's Soccer Ticket Price</title>

<script type="text/javascript">


var age;


function getAge()

{ age=prompt("Enter Customer's Age");

if (age<5){

document.getElementById("newText").innerHTML = "Cost of Ernest's ticket is $2.00";

}

else if (age>=5 && age<=15){

document.getElementById("newText").innerHTML = "Cost of Ernest's ticket is $6.00";

}

else if (age>15)

{

document.getElementById("newText").innerHTML = "Cost of Ernest's ticket is $8.00";

}

}


</script>

</head>



<body>

<header>


<h1>Ernest Tee's Soccer Ticket Price</h1>

</header>

<p>This page will decide the cost of Ernest Tee's soccer ticket price based on his age.</p>

<p><h3>Click on the button below to enter Ernest's age</h3></p>

<div id="container1">


<ul>

<li>Under age 5 (age &lt; 5) cost is $2.00 </li>

<li>Between ages 5 and 15 (5 &ge; age &le; 15) cost is $6.00</li>

<li>Older than 15 (age &gt; 15) cost is $8.00</li>

</ul>


<p><input type="button" value="Enter Ernest's Age"></p>

<p id="newText"> Pricing Unknown <br />

</p>

<br>

</div>

</body>


</html>

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote