SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Apr 2011
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Javascript "email this" button question

    I'm very new to Javascript so please bear with me. I have created an "email this" button on my site, and added a script to the button that brings up an email window with a prefilled message and the page's URL (so you can email the article to a friend, etc). I used a script I found online. My issue is that I need the link to have an anchor at the end so it points to a specific div. Ie. the script currently pulls the url as "http://www.mysite.com/artcile", when I need it to bring up "http://www.mysite.com/article#article2". I need to be able to have a different anchor for each button instance, since I will have multiple articles on the page.

    Here's the code I'm using:

    Code:
    <!-- Begin
    function isPPC() {
    if (navigator.appVersion.indexOf("PPC") != -1) return true;
    else return false;
    }
    if(isPPC()) {
    document.write('<a class="contact" HREF=\"mailto:\?subject\=Take a look at this page I found, ' + document.title + '?body=You can see this page at: ' + window.location + '\" onMouseOver="window.status=\'Send your friends e-mail about this page\'; return true" TITLE="Send your friends e-mail about this page">Email to a Friend<\/a>');
    }
    else { document.write('<a class="contact" HREF=\"mailto:\?body\=Hello,%0d%0d I came across this link on the Conasys site and thought you%27d enjoy it!%0d%0d Check it out: ' + window.location + '\" onMouseOver="window.status=\'Send your friends e-mail about this page\'; return true" TITLE="Send your friends e-mail about this page" rel="nofollow">Email This!<\/a>');
    }
    // End -->
    I don't know enough about Javascript out how to add the anchor to the link and I can't find this specific issue online, so any help would be awesome!

  2. #2
    SitePoint Member
    Join Date
    Apr 2011
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nevermind - figured it out! The anchor was already included, I just didn't have the anchor attached to my first article. Duh.


Tags for this Thread

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
  •