topical media & game development

talk show tell print

professional-javascript-10-InnerHTMLExample.htm / htm



  <html>
      <head>
          <title>InnerHTML Example</title>
          <style type="text/css">
              div.special {
                  background-color: red;
                  padding: 10px;
              }
          </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="special">This is my original text</div>
          <input type="button" value="Use InnerHTML" onclick="useInnerHTML()" />
      </body>
  </html>
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.