Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagexml
titleinner_html_demo.html
<html>
    <!-- Programmed by Chun Kang -->
    <head>
        <title>Inner HTML Test 1</title>
    </head>
    <script>
        function addContent(element_id, strContent)
        {
            document.getElementById( element_id).innerHTML += strContent;
        }
        function initContentclearContent(element_id)
        {
            document.getElementById( element_id).innerHTML ="";
        }
    </script>
    <body>
        <p id="test1">Initial content...</p>
        <input type=button onclick="javascript:addContent('test1','<br>Hello Venus!');" value="Hello Venus!"><br>
        <input type=button onclick="javascript:addContent('test1','<br>Hello Robo!');" value="Hello Robo!"><br>
        <input type=button onclick="javascript:initContentclearContent('test1');" value="!initClear"><br>
    </body>
</html>