inserting email this page to a friend on my website

T

Trevor L.

lampell said:
How do I insert on my website the form "email this page to a friend"

<form name="eMailer" action="">
Email this page to a friend<br />
Enter recipient's e-mail:
<input type="text" id="address" size="30" />
<input type="button" value="Send" onclick="mailThisUrl()" />
</form>

In the <head> section, add
<script type="text/javascript">
function mailThisUrl()
{
var subj = "I thought this might interest you..."
var text = "Here is an interesting Website: "
window.location = "mailto:"
+ document.eMailer.address.value
+ "?subject=" + subj
+ "&body=" + text + "%0d%0a"
+ document.title
+ "(" + location.href + ")"
}
<script>
 
T

Trevor L.

neutrino said:
if i remember right - you poke that code between the <head> -
/head>

Yep, the <script ............> ........</script> goes there, but not the
<form> .... </form> - it goes between <body> </body>
 
T

Trevor L.

ruffred said:
Trevor

I found that when I inserted the code in the locations you specified
that the complete page disappeared - any explanation what i might be
doing wrong.

I can't find the post to which you are replying. (I go through my newsgroup
posts in OE daily and delete those which I think are finished)

But I seem to recall that I was expanding on another reply.

All javascript code goes in the <head> section and the form goes in the
<body>. An outline of the page is:
</html>
<head>
<!-- other code for the head section -->
<script type="text/javascript">
// javascript code goes here
</script>
</head>
<body>
<!-- other code for the body section -->
<form ... >
<!-- code for the form goes here -->
</form>
<!-- other code for the body section -->
</body>
</html>

If you have done this, it should work OK. My only clue (and it maybe off
track) is that you wrote:
you poke that code between the <head> - /head>

Is /head> a typo or did you mean </head>? Without </head>, the closing tag
for the <head>, the <body> may not be read.

If this is not the reason for the problem, can you post a URL with the code
that fails.

--
Cheers,
Trevor L.
[ Microsoft MVP - FrontPage ]
MVPS Website: http://trevorl.mvps.org/
----------------------------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top