Results 1 to 3 of 3

Thread: HTML link inside javascript string

  1. #1
    Join Date
    May 2005
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default HTML link inside javascript string

    Hi all

    I have this javascript that'll let users email a page to anyone. But run across a problem. I want to link some text to another site in the email and can't figure out how to do it.

    Here's the code:

    Code:
    <script language="javascript">
    function mailpage()
    {
    mail_str = "mailto:?subject=Thought this might interest you: " + document.title;
    mail_str += "&body=I thought you might be interested in this: " + document.title;
    mail_str += ". %0D%0DYou can view it at, " + location.href;
    mail_str += ". %0D%0DSome links may require you to log in with your authorized Member user ID and password. If you are not yet a member, then explore the Partner Network to discover the benefits of becoming a Partner., " 
    location.href = mail_str;
    }
    </script>
    So I want to link the words "Partner Network" in that last string to the home page of my partner site. How can I do that?

    Thanks

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    You can put links in (<a></a>), but depending on the email client it may send as plaintext, not HTML. This, I'm afraid, is beyond your control.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    May 2005
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Yes, I am assuming that HTML is enabled. But when I code an <a href> into the last line like this:

    Code:
    mail_str += ". %0D%0DSome links may require you to log in with your authorized Member user ID and password. If you are not yet a member, then explore the <a href='http://partner.domain.com'>Partner Network</a> to discover the benefits of becoming a Partner., "
    It doesn't seem to work. I have HTML enabled in Outlook and when I test, I see the code displayed and not the text linked. Did I code it wrong? If so, what would be correct?

    Thanks

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
  •