Categories:

Home / Free JavaScripts / Forms / Here

Cut & Paste Form2PopUp script

Credit: Peter Bailey

Description: This useful script allows you to target a form's submission to a new window, so the original page does not change once the "submit" button is pressed. Instead, a customizable pop up window is launched containing the destination page. Very cool!

Example (simulated example):

Your name:
Comments

Directions:

Step 1: Insert the below script into the HEAD section of your page:

Step 2: Here is the key to the process. Inside your <form> tag, add to it the parts in red below:

<form name="sampleform" method="POST" action="/cgi-bin/formsubmit.pl" onsubmit="return createTarget(this.target)" target="formtarget">

"formtarget" can be any arbitrary target name. To customize the look of the pop up window, you can edit the attributes inside window.open() of the code of Step 1, such as dimensions, which toolbars to show etc. For more information on customizing pop ups, please see here.


JavaScript Tools:
Site Info

CopyRight 1998-2012 JavaScript Kit. NO PART may be reproduced without author's permission.