Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-09-2004, 07:18 PM   PM User | #1
ventura
New Coder

 
Join Date: Jul 2002
Location: Noblesville, IN
Posts: 94
Thanks: 0
Thanked 0 Times in 0 Posts
ventura is an unknown quantity at this point
using javascript to post a form and pop up a window.

how can i have a form that, when click a button (or text link), the main form stays on the page submits the form in a popup window?

the reason i'm doing this is because i have fields that a user fills in and i want to show in the popup what a fax is going to look like with the users fields filled in.

thanks.
__________________
Ed Ventura
Graphic/Web Designer
www.blackwatercompany.com
ventura is offline   Reply With Quote
Old 01-09-2004, 08:42 PM   PM User | #2
Roy Sinclair
Senior Coder

 
Join Date: Jun 2002
Location: Wichita
Posts: 3,880
Thanks: 0
Thanked 0 Times in 0 Posts
Roy Sinclair will become famous soon enough
Try adding target="_blank" to the <form> tag or to the <a> tag to generate the "popup" window.

Javascript isn't required for what you've described so far.
__________________
Check out the Forum Search. It's the short path to getting great results from this forum.
Roy Sinclair is offline   Reply With Quote
Old 01-11-2004, 04:29 AM   PM User | #3
jujuraf
New to the CF scene

 
Join Date: Jan 2004
Location: San Jose, CA
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
jujuraf is an unknown quantity at this point
When you make your form, you need to assign an action that runs when the form is submitted. You can do this on the line that creates the Submit button or on the <form> line itself. If done on the submit button (which doesn't have to be called Submit, here I called it btnCalc), it'd look like this:

<input name="btnCalc" type="button" value="Calculate" onClick="DoSomething()">

When the button "Calculate" is clicked, the code in the function DoSomething() is run. This is JS code directly written in the HTML page or in its own .js file, it doesn't matter.

function DoSomething()
{
var outW = window.open("", "newwin", "height=350, width=630");
outW.document.write("<HTML>")
outW.document.write("<TITLE>My Title Here</TITLE>")
outW.document.write("<hr>blah blah blah<br><hr>");
outW.document.write("</HTML>");
}

This opens a pop-up of a given size. The window is assigned to a variable outW and then that variable is used to write HTML code to the window. There are many other features you can add to the window.open() function. See any JS book for a description.

Deb
jujuraf is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:13 AM.


Advertisement
Log in to turn off these ads.