PDA

View Full Version : HTML link inside javascript string



bkdell11
08-18-2005, 09:10 PM
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:


<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

Twey
08-19-2005, 08:09 AM
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.

bkdell11
08-19-2005, 04:43 PM
Yes, I am assuming that HTML is enabled. But when I code an <a href> into the last line like this:


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