Problem with document.write()

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ackbar30
    New Member
    • Nov 2008
    • 2

    Problem with document.write()

    Hi, with mozilla firefox the following code doesn't work, notting appears on the browser, the browser is blank:
    [HTML]<!DOCTYPE html PUBLIC "-//W3C/DTD XHTML 1.0 Transitional/EN" "http://www.w3.org/TR/xhtml1 - transitional">

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head><title>ex ampletest2</title>
    <script language="JavaS cript" type="text/javascript">

    document.write( "<h1>Test</h1>");

    </script>
    </head>
    <body>
    </body>
    </html>[/HTML]
    //Can you anyone give advice please?
    Last edited by gits; Nov 8 '08, 11:23 AM. Reason: added code tags
  • ackbar30
    New Member
    • Nov 2008
    • 2

    #2
    document.write

    document.write isn't working. I don't know if is the browser? Because the browser is blank.

    Comment

    • Logician
      New Member
      • Feb 2007
      • 210

      #3
      You're writing into the body before it's rendered. Put your code block inside the body section.

      Comment

      • gits
        Recognized Expert Moderator Expert
        • May 2007
        • 5390

        #4
        don't double post your questions ... threads merged. And use a meaningful thread-title ... read the posting guidelines here.

        kind regards
        MOD

        Comment

        • waltapp
          New Member
          • Nov 2008
          • 31

          #5
          Your code is in the head. Move it into the body and it will work fine.

          Comment

          • gits
            Recognized Expert Moderator Expert
            • May 2007
            • 5390

            #6
            hi waltapp,

            please have a short look at post #3 in this thread - i quote it again:

            Originally posted by Logician
            You're writing into the body before it's rendered. Put your code block inside the body section.
            and here is your reponse:

            Originally posted by waltapp
            Your code is in the head. Move it into the body and it will work fine.
            if you want to point out some specific things it is more then welcome that you do so but simply repeating someones answer (even with other words) is quite unnecessary ... please read the thread before posting a reply.

            kind regards
            MOD

            Comment

            • waltapp
              New Member
              • Nov 2008
              • 31

              #7
              Hi , I was not logged in properly and did not see your previous reply otherwise I would not have posted.

              Comment

              • waltapp
                New Member
                • Nov 2008
                • 31

                #8
                I am new to this forum and I am glad I found it. It is excellent to have this type of interaction with other people of same interests.

                Comment

                • gits
                  Recognized Expert Moderator Expert
                  • May 2007
                  • 5390

                  #9
                  Originally posted by waltapp
                  Hi , I was not logged in properly and did not see your previous reply otherwise I would not have posted.
                  no problem ... i just wanted to gave you this hint ... because another member that you just repeat could feel uncomfortable with such beaviour and it is easy to avoid :)

                  you are very welcome at bytes.com ...

                  kind regards

                  Comment

                  Working...