Change InnerHTML : innerHTML « DOM Node « JavaScript Tutorial






<html>
    <head>
        <title>InnerHTML Example</title>
        <style type="text/css">
            .red {
                background-color: red;
            }
        </style>
        <script type="text/javascript">
            function useInnerHTML() {
                var oDiv = document.getElementById("div1");
                oDiv.innerHTML = "<b>Hello</b> world";
            }
        </script>
 
    </head>
    <body>
        <div id="div1" class="red">This is my original text</div>
        <input type="button" value="Use InnerHTML" onclick="useInnerHTML()" />
    </body>
</html>








23.11.innerHTML
23.11.1.Get element by id and change the innerHTML
23.11.2.Change hyperlink innerHTML
23.11.3.Change InnerHTML
23.11.4.innerHTML of body element