JavaScript City


E-mail a Friend (Form)

This script will allow your viewers to e-mail a friend when they click a button. Asks them for the friend's e-mail address and subject in a form, and then brings up their default e-mail program so they can type the message and send it.

Script Code

Grab a copy of the file below and place it in the same directory as the Web page on which you will use the script (if you wish to place the script file in a different directory you will need to make the necessary adjustments to the src attribute of the script tag that calls it).

semail2.js

The code below should be placed between the <body> and </body> tags where you want the form to appear.

Example

A working sample of the script is shown below.

Fill out the e-mail address and subject to e-mail a friend:


Options

You can change the appearance of the text and form by using the appropriate IDs in your your style sheet and by editing the labels in the HTML as desired.

Accessibility

Setting the form action to link to a backup server-side script that performs the same function should do the trick for those without JavaScript.



eXTReMe Tracker