How can I use document.write to do this?

Discussion in 'JavaScript' started by christopher.mah, Dec 2, 2010.

  1. #1
    Hello,
    How can i make a JavaScript file write after the </title> tag, </head> tag, </body> tag, </body> tag, ect...

    I would like it to use "document.write("")" to write what i need it to write.

    Thanks
    Chris
     
    christopher.mah, Dec 2, 2010 IP
  2. tvoodoo

    tvoodoo Active Member

    Messages:
    239
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    53
    #2
    Use jQuery and $('title').after('What to write') (to write after </title>) or $('title').before('What to write') (to write before<title>) or event $('title').append('What to write')
     
    tvoodoo, Dec 3, 2010 IP
  3. GeelongTECH

    GeelongTECH Peon

    Messages:
    154
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Use something like
    
    <script>
    /*Adds Stuff To The Title Of The Page*/
    $("title").append( document.createTextNode(" | Title") );
    
    /*Write's In The Head*/
    $("head").append( document.write("") );
    
    /*Write In Thoe Body*/
    $("body").append( document.write("") );
    </script>
    
    HTML:
     
    GeelongTECH, Dec 4, 2010 IP