topical media & game development

talk show tell print

professional-javascript-10-InnerTextExample2.htm / htm

          <title>InnerText Example</title>
          <style type="text/css">
              div.special {
                  background-color: red;
                  padding: 10px;
          <script type="text/javascript">
              function useInnerText() {
                  var oDiv = document.getElementById("div1");
                  oDiv.innerText = oDiv.innerText;
          <div id="div1" class="special"><b>Hello</b> world</div>
          <input type="button" value="Use InnerText" onclick="useInnerText()" />
          <p><strong>Note: </strong> Firefox does not support the <code>innerText</code> property so this example will fail.</p>

(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.