Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
|
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 29th, 2005, 06:52 AM
Authorized User
 
Join Date: Nov 2005
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default passing data to javascript pop up

Hay people, just signed up, dont know why i dident do it eariler, looking forward to using this great resource

Quick question 1:

I have a form, one text box, on hitting submit or enter i want it to pop up a new window, passing the textbox data to that page in the window.

2 ways i know of, POST and querrystring, dont mind what i use, just dont know how, have the window opening with javascript:window.open('page',..... but dont know how to get the form data to the page?

Quick question 2:

I have a login page in a popup, if the user logs in it resizes the popup, i would also like to add scrollbars on the resize, but the page dosent have them to begin with, so is there a way to add scrollbars to a page when the page is already open?

thanks for any help!
 
Old November 29th, 2005, 07:56 AM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

Whether you use GET or POST is governed by the method attribute of your <form>.

I assume you are using javascript because you want to control window size etc, otherwise you could just add target="_blank" to your <form>

You could create a new window and then set the form's target to the new window...
Code:
function DoSubmit(form){
    var winName = form.name + "_win";
    window.open("", winName, "scrollbars=no");    
    form.target = winName;
    form.submit();
}
...

<form name="myForm" action="wrox.asp" onsubmit="DoSubmit(this);">
    <input type="hidden" name="myHidden" value="myHiddenValue">
    <input type="submit">
</form>
AFAIK you cannot change the scrollbars setting on a window after it has been opened. You could create a div that fills the entire page with it's style overflow attribute set to auto for a similar effect.

HTH,

Chris

 
Old November 29th, 2005, 10:38 AM
Authorized User
 
Join Date: Nov 2005
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Perfect, thanks for ya help Chris






Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing data from PHP to Javascript oldBroh Javascript How-To 12 June 12th, 2008 11:12 PM
Passing data from PHP to Javascript youngj PHP How-To 4 February 22nd, 2006 11:55 PM
Passing value across iframe and pop-up window muklee Javascript 1 October 28th, 2004 04:44 PM
passing data btwn asp page and javascript include Justine Classic ASP Professional 8 August 20th, 2004 02:23 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.