Do you avoid using forms because of that ugly static page the form-handling script returns when the form is submitted?

 
You know, the one that looks like this:

 
GeoCities Form Mail Response

YOU CAN USE JAVASCRIPT TO "FIX" THIS PROBLEM !

Eliminate the static page returned by the form handling script!


 

Demo of this ghost function form handler

Your name: privacy policy
Your email:
first argument:

set message for ghost window
 

second argument:


set action (url) after submit
  • no value or 0 (default) - return to this page
  • 1 - go to page before this one
  • netSperience - go to netSperience home page
  • any other URL - go to the URL
 
 

 
Add a little JavaScript magic in 3 simple steps!
 
 
Method #1
Using a .js file

(for use on several web pages)
 
Save ghost.js , then upload the JavaScript file to your server.
On each web page, load ghost.js with this code in the <head> (insert it just before </head>):
 

For pages in directories other than the one with ghost.js, insert the appropriate path: src= URL of ghost.js
 
 
Method #2
Installation on a single page

 
Copy and paste this code in the <head> (insert it just before </head>):

 
Both Methods
Add this JavaScript event handler to the <FORM> tag:  onSubmit='ghost("first argument",second argument)'
 

 

The ghost function takes two arguments (inside the parentheses):

First argument: A brief message for a little floating window that lets your visitor know the information from the form has been sent. Be sure to remember the "quotes."
 
Second argument: DEFAULT OPTION (no value entered) will return to the page with the form; OTHER OPTIONS After a comma, tell the ghost function which URL to redirect the browser to when the message window closes.
  • 0 will return to the page with the form (same as default);
  • 1 will go back to the page before the one with the form.
    (Do not enclose these numbers in quotes);
  • "netSperience" will redirect to my netSperience web site
    (don't forget the quotes and the capital S);
  • OR, enter any URL (in quotes, eg: "http://www.geocities.com")
    and the browser will go to that page.

 
When your visitor submits the form, the script opens a small window with your message. Meanwhile, the form mail response window loads behind it. The message window closes itself five seconds after the five-second countdown animated gif loads, and the main window is redirected to the desired page.

 
Important!
 
Save this five-second countdown animated gif and upload it to your server in the same directory as ghost.js
 
five-second countdown

 

Feel free to use this form handler, but...

Please acknowledge my effort and ingenuity with a link to netSperience

ok?


 
 
 
are you netSperienced?a  netSperience  website
 
©2003 by  Randall Goya

 
 <||> netSperience <||> JavaScript <||> Tools <||> Résumé <||> Guest Book <||> Hosted by [ Geocities icon ]
Get your own
Free Home Page
Hosted by www.Geocities.ws

1