We Recommend

Pro JavaScript Techniques Pro JavaScript Techniques
Pro JavaScript Techniques is the ultimate JavaScript book for the modern web developer. It provides everything you need to know about modern JavaScript, and shows what JavaScript can do for your web sites. This book doesn't waste any time looking at things you already know, like basic syntax and structures.


Posted By

skywalker on 04/28/08


Tagged

email url mail page send


Versions (?)


Who likes this?

3 people have marked this snippet as a favorite

dyesin
blackabee
korzhik


Email this page


Published in: JavaScript 


This gets the current page addr. and send it... Modify form action="" to send values to proper mail function - or - class.

  1. <SCRIPT LANGUAGE="JavaScript">
  2. <!-- Original: Ronnie T. Moore -->
  3. <!-- Web Site: The JavaScript Source -->
  4.  
  5. <!-- This script and many more are available free online at -->
  6. <!-- The JavaScript Source!! http://javascript.internet.com -->
  7.  
  8. <!-- Begin
  9. function initMail(form) {
  10. text = "Check out this page: " + window.location;
  11. form.message.value = "Hi " + form.sendto.value + " (" + form.to.value + "):\n\n"
  12. + text + "\n\nYour Friend,\n" + form.sendername.value + "(" + form.senderemail.value + ")";
  13. return (form.to.value != "");
  14. }
  15. // End -->
  16. </script>
  17.  
  18.  
  19. //////////////////////////////////////////////////////////////////////////////
  20. //include this form content to pages that you may want to show.
  21.  
  22.  
  23. <center>
  24. <form name=emailform method=post action="http://cgi.freedback.com/mail.pl" target="_new" onSubmit="return initMail(this);">
  25. <input type=hidden name=subject value="** Check Out This Site! **">
  26. <input type=hidden name=message value="">
  27. <table>
  28. <tr><td colspan=2 align=center>Tell a friend about this page!</td></tr>
  29. <tr><td>Their Name:</td><td><input type=text name=sendto></td></tr>
  30. <tr><td>Their Email:</td><td><input type=text name=to></td></tr>
  31. <tr><td>Your Name:</td><td><input type=text name=sendername></td></tr>
  32. <tr><td>Your Email:</td><td><input type=text name=senderemail></td></tr>
  33. <tr><td colspan=2 align=center><input type=submit value="Ok!"></td></tr>
  34. </table>
  35. </form>
  36. </center>

Report this snippet 

You need to login to post a comment.