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

This must be done in Javascript Add JavaScript in the changePage function so tha

ID: 3812850 • Letter: T

Question

This must be done in Javascript

Add JavaScript in the changePage function so that clicking on the Use Current Astronomy button does the following: 1. Uses removeAttribute0 to remove the hidden attribute from the paragraph with the id p2, causing the paragraph to become visible. 2. Uses the innerHTML property of the span with the id lastPlanet to change the name of the farthest planet to "Neptune". The quotation marks around Neptune are necessary 3. Uses -style textDecoration to set style attribute of the span text to "underline". The quotation marks around "underline" are necessary Use document getElementByld() to access the DOM nodes.

Explanation / Answer

Hi,

Please the the jovascript code below.

<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">


<script type="text/javascript">
function changePage(){
  
   document.getElementById("p2").removeAttribute("hidden"); // Removes the hidden attribute
   document.getElementById("lastplanet").innerHTML='"Neptune"'; //Changes the text of span from Pluto to "Neptune"
   document.getElementById("lastplanet").style.textDecoration = "underline"; //Underlines the span text
}
</script>
</head>
<body>
<h1>The farthest planet.</h1>

<p id="p1">Pluto was discovered in 1930 and designated as a planet.</p>
<p id="p2" hidden>In 2006, Pluto was reclassified as a dwarf planet.</p>

<p><span id="lastplanet">Pluto</span> is the farthest planet from the Sun.</p>

<input type="button" value="Use Current Astronomy">
</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