Kevin said:
Click here to email this page. (Freestyle Script)
--
;-),
Kevin Spencer
Microsoft MVP
.Net Developer
A watched clock never boils.
--
But seriously, folks
JS
function mailThisUrl()
{
var subj = "I thought this might interest you..."
var text = "Here is an interesting Website: "
var content = new Array()
content[0] = "mailto:"
content[1] = document.eMailer.address.value
content[2] = "?subject="
content[3] = subj
content[4] = "&body="
content[5] = text
content[6] = parent.document.title
content[7] = " ("
content[8] = parent.location
content[9] = ")"
content = content.join("")
window.location = content
}
HTML
<form name="eMailer" action="">
<b>E-Mail this link to a friend</b><br>
Enter recipient's e-mail:<br>
<input type="text" name="address" size="30"><br>
<input type="button" value="Send this URL" onClick="mailThisUrl();">
</form>
Or you could add the function
function checkEmailAddress(field)
{
/*****
Script: Automatic E-mail This Link Script
With Auto-Capture and Validation
Browsers: IE4-6, NS4-6
Author: etLux
© 2000
www.CodeLifter.com
http://www.codelifter.com
Free for all users, but leave in this header
*****/
// 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 }
}
and change the last line of function mailThisUrl() to:
if (checkEmailAddress(document.eMailer.address))
window.location = content
Cheers,
Trevor L.
Website:
http://tandcl.homemail.com.au