Ruth said:
Ok, Trevor, thanks...but, I have NO IDEA where to place this code
within my page...For example, you have an end form (/form) tag but I
don't see the beginning form tag.
Although I am an exceptional web designer, I don't claim to know
everything and I'm pitifully clueless on what to do with this
wonderful code you've sent me...as I can see it checks for valid
email address and mails a URL and a page?...help please!
No, it doesn't send the page itself, it places the URL of the page in an
Email so the body of the Email looks like this:
Here is an interesting Website:
Trevor and Carole's Home Page (
http://tandcl.homemail.com.au/index.html )
As to what goes where:
This goes between <head> and </head>
function checkEmailAddress(field)
{
// the following expression in () after 'match' must be all on one
line... if
(field.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi))
return true
else
{ alert('Please enter a valid e-mail address.')
field.focus()
field.select()
return false }
}
//-------------------------------
function mailThisUrl()
{
var subj = "I thought this might interest you..."
var text = "Here is an interesting Website: "
var content = "mailto:"
+ document.eMailer.address.value
+ "?subject=" + subj
+ "&body=" + text + "%0d%0a"
+ document.title
+ " (" + location.href + ")"
if (checkEmailAddress(document.eMailer.address))
window.location = content
}
//-------------------------------
The form (which does have a <form> tag) goes in between <body> and </body>
<form name="eMailer" action="">
Email this Page/Link to a Friend<br />
<input type="text" id="address" size="30" />
<input type="button" value="Send" onclick="mailThisUrl()" />
</form>
BTW, Deliverent is a free sevice. I think it is financed by the ads which
appear on the sent page.
I have a link to use it in my web page - it is marked
EMAIL THIS PAGE
As HTML
This sends the whole page as HTML. It works quite nicely, but there are two
points I think you should note:
1. Some people turn off HTML in their Email client.
2. You may only want to send a link to the page. My code does this.
Try either (or both as I have)