Are you sure you want to use JavaScript for this? As far as I'm aware, it can't send email directly so how do you expect to use it to tell people about the site in question?
I found one script: "<SCRIPT LANGUAGE="JavaScript"> <!-- Begin //Tell-a-friend script //Carl Dimmer var initialsubj="Hay 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)|(\.sex)|(\.biz)|(\.aero)|(\.coop)|(\.museum)|(\.name)|(\.pro)|(\..{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.eMailer.email); if (good) { //window.location = "mailto:"+document.eMailer.email.value+"?subject="+initialsubj+"&body="+document.title+" "+u; window.location = "mailto:"+document.eMailer.email.value+"?subject="+initialsubj+"&body="+initialmsg } } // End --> </script> <form name="eMailer"> 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 type="button" value="Send this URL" 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" onClick="mailThisUrl();"> </form>" But it sends the web address plus email at the end like: " Hi: You may want to check out this site: http://www.mysite12388.com/e-mail to a friend-.html " What do I need changed in the script to have a message "Hi: You may want to check out this site: http://www.mysite12388.com/' Thank you! st12
Not sure about this, try this instead. <SCRIPT LANGUAGE="JavaScript"> <!-- Begin //Script by Trånn: http://come.to/tronds //Submitted to JavaScript Kit (http://javascriptkit.com) //Visit http://javascriptkit.com for this script var initialsubj="Hay 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)|(\.sex)|(\.biz)|(\.aero)|(\.coop)|(\.museum)|(\.name)|(\.pro)|(\..{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.eMailer.email); if (good) { //window.location = "mailto:"+document.eMailer.email.value+"?subject="+initialsubj+"&body="+document.title+" "+u; window.location = "mailto:"+document.eMailer.email.value+"?subject="+initialsubj+"&body="+initialmsg } } // End --> </script> <form name="eMailer"> 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 type="button" value="Send this URL" 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" onClick="mailThisUrl();"> </form> Code (markup):
I tested this on my browser with Outlook and it works fine. This suggests there is a problem with how it interacts with your email program. This is the problem with using JS to do this (not mentioning the fact that some people with webmail acounts can't use it). You really need to try implement a php script to do the job.
mad4 the Java script you gave is not good enough the web address comes with /email at the end. thank you thogh. I'll check the php
Since my tell a friend page got waked hacked and spamed this morning http://forums.digitalpoint.com/showthread.php?p=1020391#post1020391 I went looking for some with more security and this was the one i found in 3 hours looking. http://www.tacticalsuccess.com/stw/index.php http://www.maianscriptworld.co.uk/scripts_friend.html http://www.pixelatedbylev.com/downloads.php?action=desc&id=4508 Hopes this helps
Hello, I have tested several scripts and Super Tell A Friend PRO seems to be the best. You can test it online here: http://www.super-tell-a-friend.com I hope this helps.