Home HTML Data Types DOM JavaScript JS Debugging Review Ticket

Hacks

  • Copy your HTML code from the HTML hacks. Write a Javascript snippet to switch the links of the two a tags when a button is pressed. Once they are switched, change the inner HTML of the top p tag to the word “switched!”
%%html
<html lang="en-US">
<head>
    <title>Movie Info</title>
</head>
<body>
    <div>
        <h2>Interstellar</h2>
        <h4><strong> Basic Synopsis</strong> </h4>

           <p> <br>
            In Earths future, a global crop blight and second Dust Bowl are slowly rendering the planet uninhabitable. Professor Brand (Michael Caine), a brilliant NASA physicist, is working on plans to save mankind by transporting Earth's population to a new home via a wormhole. But first, Brand must send former NASA pilot Cooper (Matthew McConaughey) and a team of researchers through the wormhole and across the galaxy to find out which of three planets could be mankind's new home.
            <br><br>
        </p>
    
    
        <button> Actors<br><br>
                
                1. Matthwe McConaughey<br>
                2. Anne Hathaway<br>
                3. Jessica Chastain <br>
                4. Bill Irwin<br>
                5. Micheal Cane<br>
                
                
        </button>
        <br>
        <button onclick="goToInterstellarWiki()">Go to Interstellar Wiki</button>
    
        <script>
            function goToInterstellarWiki() {
                // Redirect to the Interstellar Wikipedia page
                window.location.href = "https://en.wikipedia.org/wiki/Interstellar_(film)";
            }
    </script>
    </div>
    <br>
    <center>
        <img src="https://upload.wikimedia.org/wikipedia/en/b/bc/Interstellar_film_poster.jpg" alt="Interstellar_film_poster" height="320" width="200">
    </center>
    <br><br>
    <div>
        <h2>Martian</h2>
        <center>
            <img src="https://upload.wikimedia.org/wikipedia/en/c/cd/The_Martian_film_poster.jpg" alt="The_Martian_film_poster" height="320" width="200">
        </center>
<br><br><br>

        <button onclick="toggleMartianTrailer()">Check Out the trailer</button>

        <a id="martianLink" href="https://www.imdb.com/title/tt3659388/">Martian: IMDb</a><br>

        <script>
            let isMartianTrailer = false;

            function toggleMartianTrailer() {
                const link = document.getElementById('martianLink');

                if (isMartianTrailer) {
                    link.href = "https://www.youtube.com/watch?v=Ue4PCI0NamI";
                    link.textContent = "Martian: YouTube Trailer";
                    isMartianTrailer = false;
                } else {
                    link.href = "https://www.imdb.com/title/tt3659388/";
                    link.textContent = "Martian: IMDb";
                    isMartianTrailer = true;
                }
                topPTag.innerHTML = "Yay! You've Switched links!"
            }
        </script>


<button onclick="toggleMartianClips()">Check Out A martiqn clip</button>

<a id="martianLink2" href="https://en.wikipedia.org/wiki/The_Martian_(film)">Martian: Wiki</a><br>

<script>
    let isMartianClips = false;

    function toggleMartianClips() {
        const link = document.getElementById('martianLink2');

        if (isMartianClips) {
            link.href = "https://www.youtube.com/watch?v=BH-UmA5Lt3g";
            link.textContent = "Martian: YouTube clop";
            isMartianClips = false;
        } else {
            link.href = "https://en.wikipedia.org/wiki/The_Martian_(film)";
            link.textContent = "Martian: Wiki";
            isMartianClips = true;
        }
        topPTag.innerHTML = "Yay!, You're gonna love the movie!";
    }
</script>

        <br><br>

        <h4><strong>Basic Synopsis</strong></h4>
        <br><br>
        <p id="topPTag">When astronauts blast off from the planet Mars, they leave behind Mark Watney (Matt Damon), presumed dead after a fierce storm. With only a meager amount of supplies, the stranded visitor must utilize his wits and spirit to find a way to survive on the hostile planet. Meanwhile, back on Earth, members of NASA and a team of international scientists work tirelessly to bring him home, while his crew mates hatch their own plan for a daring rescue mission.</p>
        <br>
    </div>
</body>
</html>

Movie Info

Interstellar

Basic Synopsis


In Earths future, a global crop blight and second Dust Bowl are slowly rendering the planet uninhabitable. Professor Brand (Michael Caine), a brilliant NASA physicist, is working on plans to save mankind by transporting Earth's population to a new home via a wormhole. But first, Brand must send former NASA pilot Cooper (Matthew McConaughey) and a team of researchers through the wormhole and across the galaxy to find out which of three planets could be mankind's new home.



Interstellar_film_poster


Martian

The_Martian_film_poster



Martian: IMDb
Martian: Wiki


Basic Synopsis



When astronauts blast off from the planet Mars, they leave behind Mark Watney (Matt Damon), presumed dead after a fierce storm. With only a meager amount of supplies, the stranded visitor must utilize his wits and spirit to find a way to survive on the hostile planet. Meanwhile, back on Earth, members of NASA and a team of international scientists work tirelessly to bring him home, while his crew mates hatch their own plan for a daring rescue mission.