How to Make a Form to Share a Link With a Friend

How to Make a Form to Share a Link With a Friend thumbnail
Email gives you a quick way to share Web pages with friends.

Share-a-Link is an online form, designed to increase traffic to the shared page, such as an e-commerce site or blog. The shared page often has a text link, which takes you to the actual form. The form asks for your email and your friend's email. An email script processes the form in the back-end when you submit it. It emails the link to your friend, notifying them that you recommended the page.

Things You'll Need

  • Text editor
  • Email script
  • Internet
Show More

Instructions

    • 1

      Start a text editor, such as Notepad, EditPad or TextPad. Click "File" and "Open" and double-click the HTML file where the text link will appear.

    • 2

      Place your cursor where you want the text link to go and type:

      <br /><a href="sharealink.html">Recommend this page to a friend</a><br />

    • 3

      Click "File" and "Save" to save the page. Close the file and select "File" and "New" to create a new document for the form script.

    • 4

      Insert the following HTML code into the page:

      <html>
      <head>
      <title>Recommend Page to Friend</title>
      </head>
      <body>
      </body>
      <html>

    • 5

      Highlight the following JavaScript code, derived from JavaScript Kit:

      <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>

    • 6

      Press "Ctrl" and "C" to copy it. Return to your HTML file and place your cursor between the opening and closing "BODY? tags. Press "Ctrl" and "V" to paste the copied code.

    • 7

      Click "File" and "Save." Name the file "sharealink.html" in the "Save As" dialog box and click "Save."

Related Searches:

References

  • Photo Credit Medioimages/Photodisc/Photodisc/Getty Images

Comments

Related Ads

Featured