logo
g Text Version
Beauty & Self
Books & Music
Career
Computers
Education
Family
Food & Wine
Health & Fitness
Hobbies & Crafts
Home & Garden
Money
News & Politics
Relationships
Religion & Spirituality
Sports
Travel & Culture
TV & Movies

dailyclick
Bored? Games!
Nutrition
Postcards
Take a Quiz
Rate My Photo

new
Weddings
Bereavement
Natural Living
Walking
Dogs
Holistic Health
Gifted Education


dailyclick
All times in EST

Full Schedule
g
g ASP Site

BellaOnline's ASP Editor

g

Creating Send to a Friend Functionality in ASP

Guest Author - Lisa Shea

You've seen them before on webpages - the links that make it easy for someone to forward the URL and info along to a friend. It's free marketing! How do you implement it?

There are two parts to the code. First, there's a little JavaScript snippet that you are going to put into each page. You don't want to have to hand-code it for each page, that would be very tedious. So instead you make it nice and automatic. The snippet you insert into your webpages, whereever you'd like the 'email a friend' button to show up, is:

<!-- *** SEND-A-FRIEND START *** -->
<script language="JavaScript">var strCode='';</script>
<script src="/SendAFriend.asp"></script>
<script language="JavaScript">document.write(strCode);</script>
<!-- ***SEND-A-FRIEND END *** -->

So far so good. Now you have to make this SendAFriend.asp file - the one that will fill in the 'guts' of this button, and customize it for each page that you're going to use it with. Ignore my ********s, I just put those in to mark out where the code is for you.

*******************************

<%
FrTxt = "<table cellspacing=0 cellpadding=2 border=0 bgcolor=#9999FF><TR><TD>"
FrTxt = FrTxt + "<TABLE bgcolor=#FFFFFF><tr><td align=center>"
FrTxt = FrTxt + "<b>Enjoy this article?<BR>"
FrTxt = FrTxt + "Send this along to a friend!</b><BR>"
FrTxt = FrTxt + "<a HREF=emailfriend.asp?URL="
FrTxt = FrTxt + request.servervariables("HTTP_REFERER")
FrTxt = FrTxt + "&ID=0>"
FrTxt = FrTxt + "<IMG SRC=email.jpg border=0></A>"
FrTxt = FrTxt + "</TD></TR></TABLE></TD></TR></TABLE>"

strRet = "strCode='" & FrTxt & "'"
Response.Buffer = TRUE
Response.ContentType = "application/x-javascript"
Response.Write strRet

%>

*******************************

In essence what this code is doing is making a block of HTML code that is within 2 tables. The tables give it a nice border. There's an 'email.jpg' which is the button the person presses.

The next part is where you actually ask the user to put in their email address and their friend's email address and so on. Make sure that these two pieces work first, though - that you can include the javascript snippet in your base page, and that it properly brings in the information in your SendFriend.asp file. You won't be able to PUSH the button yet, but you should at least SEE the button and text :)

Next, gather the information from the user to Send a Friend

Introduction to ASP Ebook

Download this ebook to get everything you need to know about learning ASP - from a step by step tutorial to function lists, sample code, common errors and solutions, and much more! 101 pages.
This site needs an editor - click to learn more!

Add Creating+Send+to+a+Friend+Functionality+in+ASP to Twitter Add Creating+Send+to+a+Friend+Functionality+in+ASP to Facebook Add Creating+Send+to+a+Friend+Functionality+in+ASP to MySpace Add Creating+Send+to+a+Friend+Functionality+in+ASP to Del.icio.us Digg Creating+Send+to+a+Friend+Functionality+in+ASP Add Creating+Send+to+a+Friend+Functionality+in+ASP to Yahoo My Web Add Creating+Send+to+a+Friend+Functionality+in+ASP to Google Bookmarks Add Creating+Send+to+a+Friend+Functionality+in+ASP to Stumbleupon Add Creating+Send+to+a+Friend+Functionality+in+ASP to Reddit




RSS | Editor's Picks Articles | Top Ten Articles | Previous Features | Site Map


For FREE email updates, subscribe to the ASP Newsletter


Past Issues


print
Printer Friendly
bookmark
Bookmark
tell friend
Tell a Friend
forum
Forum
email
Email Editor


Content copyright © 2013 by Lisa Shea. All rights reserved.
This content was written by Lisa Shea. If you wish to use this content in any manner, you need written permission. Contact BellaOnline Administration for details.

g


g features
Best uses for RSS

RSS and its future.

Force Download Dialog box with ASP

Archives | Site Map

forum
Forum
email
Contact

Past Issues
memberscenter


vote
Earth Day Favorite
Eating Local
Enjoying Nature
Spring Cleaning
Helping Others



BellaOnline on Facebook
g


| About BellaOnline | Privacy Policy | Advertising | Become an Editor |
Website copyright © 2013 Minerva WebWorks LLC. All rights reserved.


BellaOnline Editor