Web Hosting Directory | Web Hosting Resources | Webmaster Resources | Domain Tools | Search Engine Marketing | Forums
  Signup
Today: 403   Yesterday: 1,557   Max: 1,872   Total: 377,678   Current Users : 11 (Member 0) 
DOMAIN TOOLS

WEBMASTER TOOLS

RELATED ARTICLES

SUBMIT AN ARTICLE

Write for us and get publicity, link to your website, and best of all get paid. Please visit our writers page for details.


LINK TO US

Link to us and earn points for each visitor you bring to us. Please visit our link partner page for details.

 

Popup Windows: From a Form

For our next variation on the popup theme we're going to open the popup from a form. In this example we're going to change the script around. The following script is custom designed for opening a popup from a form. (We'll gloss over the details of how the script works for now. For the gory details on this script see Under the Hood: The Popup From a Form Script.) It works with forms that use both POST and GET. Copy the following script exactly as-is into the <HEAD> section of your document:

<SCRIPT TYPE="text/javascript">
<!--
function popupform(myform, windowname)
{
if (! window.focus)return true;
window.open('', windowname, 'height=200,width=400,scrollbars=yes');
myform.target=windowname;
return true;
}
//-->
</SCRIPT>

Now we'll add some code so that the popup opens when the user submits the form. Add an onSubmit attribute to <FORM ...> tag:

<FORM METHOD=POST
   ACTION="../cgi-bin/mypopupcgi.pl"
   onSubmit="popupform(this, 'join')">

The first argument for popupform() is always this, meaning the form itself. The second argument, 'join' in this case, is a unique name for the popup.

name:
email:


Copyright 1997-2002 Idocs, Inc. Written by Miko Sullivan.

 
 
What is your major source of website traffic?
 
 
 
 
 
 

ADVERTISEMENT

 
Cheap Web HostingBudget Web HostingEcommerce Web Hosting
Link to UsLink ExchangeAdvertisePrivacy PolicyTerms Of ServiceAbout UsContact UsSitemap
Copyright © 2006 - 2008 Broadband Media, Inc. All rights reserved.