topical media & game development

talk show tell print

professional-javascript-10-OuterTextExample.htm / htm

          <title>OuterText Example</title>
          <style type="text/css">
              div.special {
                  background-color: red;
                  padding: 10px;
          <script type="text/javascript">
              function useOuterText() {
                  var oDiv = document.getElementById("div1");
                  oDiv.outerText = "This is some new text not inside a DIV.";
          <div id="div1" class="special">This is my original DIV</div>
          <input type="button" value="Use OuterText" onclick="useOuterText()" />
          <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.