Skip to main content

Ivan Teoh

Something personal yet public

174-homework2.html

(Source)

<!DOCTYPE HTML>
<html lang="en">
<head>
    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
    <title>JavaScript 101</title>
    <script type="text/javascript">
        function load()
        {

            function removeElement(node) {
                parent = node.parentNode;
                if (parent) {
                    parent.removeChild(node);
                }
            }
            console.log(removeElement(document.body.childNodes[1]));

        }
    </script>
</head>
<body onload="load()">
    <h1>This is a header!</h1>
    <p id="excitingText">
        This is a paragraph! <em>Excitement</em>!
    </p>
    <p>
        This is also a paragraph, but it's not nearly as exciting as the
        last one.
    </p>
</body>
</html>