SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    Mar 2007
    Posts
    43
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    javascript code to get title

    So I am working with some code, the code basically need to get 2 things the page url and the title it get's the url ok but the title is not inserting right maybe it is just late here but I can't figure it out.



    <a id="myid" href="#">blah</a>

    <script type="text/javascript">
    document.getElementById('myid').href='http://mysite.com&url='+escape(location.href)+'&title='+escape(location.title)';
    </script>

  2. #2
    SitePoint Evangelist
    Join Date
    Jul 2007
    Posts
    345
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try document.title
    and lose the trailing '

  3. #3
    SitePoint Enthusiast
    Join Date
    Mar 2007
    Posts
    43
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ha damn missed the trailing ' Thanks works great


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
  •