SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    Procrastinator Extraordinaire lucas's Avatar
    Join Date
    Oct 2000
    Location
    Springfield, Missouri, U.S.A.
    Posts
    320
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I would like to put the title of the page within the document as sort of a page heading. Can you do this with javascript?

  2. #2
    SitePoint Enthusiast
    Join Date
    Feb 2001
    Location
    D¨n ╔ideann, Alba
    Posts
    72
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    (A) inline ...

    <script language=javascript type="text/javascript">
    document.write(parent.window.title) ;
    </script>


    (B) functional ...

    in body text put:
    <script language=javascript type="text/javascript">
    getTitle(writeTitle)
    </script>

    in head put:
    <script language=javascript type="text/javascript">
    var writeTitle = '' ;
    function getTitle(){
    return writeTitle = document.write(parent.window.title) ;
    </script>


  3. #3
    Procrastinator Extraordinaire lucas's Avatar
    Join Date
    Oct 2000
    Location
    Springfield, Missouri, U.S.A.
    Posts
    320
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you rule

  4. #4
    Procrastinator Extraordinaire lucas's Avatar
    Join Date
    Oct 2000
    Location
    Springfield, Missouri, U.S.A.
    Posts
    320
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    neither one works, the inline one writes "undefined" and the functional one says writetitle is undefined....

  5. #5
    SitePoint Enthusiast
    Join Date
    Feb 2001
    Location
    D¨n ╔ideann, Alba
    Posts
    72
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    sorry lucas ...

    that should be document.title instead of parent.window.title !


  6. #6
    Procrastinator Extraordinaire lucas's Avatar
    Join Date
    Oct 2000
    Location
    Springfield, Missouri, U.S.A.
    Posts
    320
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    feel sorry for me, i'm javascript illiterate...


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •