Announcement

Collapse
No announcement yet.

document.writeIn()

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • document.writeIn()

    Alright.......I recently found out the use of document.writeIn().....How do I get the document.writeIn() to add to my page(not delete everything and just show my document.writeIn()), kind of like a running tally.

  • #2
    use document.write()

    Comment


    • #3
      Re: document.writeIn()

      Originally posted by xSKATEx
      Alright.......I recently found out the use of document.writeIn().....How do I get the document.writeIn() to add to my page(not delete everything and just show my document.writeIn()), kind of like a running tally.
      Firstly; it's document.writeln (small L)
      As in WRITE LINE

      Not document.writeIn (uppercase i)
      As in WRITE IN

      Secondly; both document.writeln and document.write will overwrite the document if invoked after the document has been loaded. What I think you are looking for is either, innerText which is IE proprietary or innerHTML which is supported by IE5+ and NS6+.

      More info on writeln can be found here.

      .....Willy

      Comment


      • #4
        In IE you can use the insertAdjacentHTML() method, but generally you just whack a span at the end of your document and use the innerHTML property which is common to both IE and Netscape 6+.

        Code:
        <button onclick="appendText()">Click Me</button>
        <span id="eof"></span>
        </body>
        </html>
        
        <script language="Javascript">
        function appendText() {
          var eof = document.getElementById("eof");
          eof.innerHTML += "<br><i>Another</i> line of content";
        }
        </script>
        BTW, the only difference between document.write() and document.writeln() is that the latter adds a line-feed to the end of the line (for better readability).
        Jon Hanlon

        Comment


        • #5
          thx!

          Comment

          Working...
          X