- Impact
- 328
A JavaScript Tell-A-Friend
Enter this between the <head> and </head> tags.
Enter the following code in between your <body> and </body> tags. Where you want the form to appear.
Then just upload your page and voila!
Enter this between the <head> and </head> tags.
Code:
DO NOT EDIT ANYTHING OTHER THAN THE initialsubj AND initialmsg.
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var initialsubj="Hey buddy, take a look at this"
var initialmsg="Hi:\n You may want to check out this site: "+window.location
var good;
function checkEmailAddress(field) {
var goodEmail =
field.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\.info)|(\.biz)|(\.name)|(\..{2,2}))$)\b/gi);
if (goodEmail) {
good = true;
}
else {
alert('Please enter a valid address.');
field.focus();
field.select();
good = false;
}
}
u = window.location;
function mailThisUrl() {
good = false
checkEmailAddress(document.tella.email);
if (good) {
//window.location =
"mailto:"+document.tella.email.value+"?subject="+initialsubj+"&body="+document.title+"
"+u;
window.location =
"mailto:"+document.tella.email.value+"?subject="+initialsubj+"&body="+initialmsg
}
}
// End -->
</script>
Enter the following code in between your <body> and </body> tags. Where you want the form to appear.
Code:
<form name="tella">
Tell a friend:
<input type="text" name="email" size="26" value=" Enter Address
Here" onFocus="this.value=''" onMouseOver="window.status='Enter email
address here and tell a friend about this site...'; return true"
onMouseOut="window.status='';return true">
<br>
<input name="button" type="button" onClick="mailThisUrl();"
onMouseOver="window.status='Click to send an email (with this page
address) to a friend! Enter email address above...'; return true"
onMouseOut="window.status='';return true" value="Send!">
</form>
Then just upload your page and voila!










