Web Hosting Talk







View Full Version : Question for JS Guru's


chilliboy
11-22-2000, 06:23 AM
I'm looking for some java script which will help me perform the the following function:-

I want to have a 'mail this page to a friend button on each of my pages which automatically opens up a new e-mail in the users microsoft outlook and insets the page url in the body of the e-mail (using the mailto: function).

I know you would insert a link like this:
<a href="mailto:?subject=send a page url&body=URL of current page">Send this page
to a friend</a>

BUT: Is there any way that I can do this (possibly using a JS function) that would automatically enter the URL of the 'current page' into body= , rather that hand coding it for every page?

I've got over 600 page so handcoding would be a real chore!

HX
11-22-2000, 07:02 AM
document.write('<a href= etc, etc, etc '+top.window.location

chilliboy
11-22-2000, 02:45 PM
Thanks for the advise. I would be most grateful if you could embelish on it a little, as the only Javascript I've used up to know are the pre-set functions in Dreamweaver.

I've tried everything to get what you said, to try and get it to work, but I'm having big problems on where to insert all the tags etc

The code I ended up with was:

<script language="JavaScript">
<!--
document.write('href=%22mailto:?subject=&amp;amp;body=+top.window.location')>Send
this page to a friend </a>
//-->
</script>

This however removes the 'Send this page to a friend' link from view.

All I want to do is open up a blank e-mail, with just the current page URL link inserted into the body.