473,779 Members | 2,035 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Setting variables in another window

Hi,

I'm trying to create specific pop'up window (for product category
selection), but in JS I'm a newbie
and some problem occured, so I have a question:

Is it possible in main window (that opens a popup) to set in popup window:
1. global variables
2. form fields

For example, I'm opening popup window like below:
categories=wind ow.open(address ,"categories"," scrollbars=no,h eight=400,width =
600");

Then I try to set global variable in popup window:
categories.glob al_variable = 1; //no effect

Or try to set form field:
categories.docu ment.some_form. some_filed.valu e = "some value"; //no effect

If none of above won't work, how could I pass some data to another window
using JS?

Greets
adeon

Jul 20 '05 #1
3 4185
"adeon" <ad***@tlen.p l> writes:
Is it possible in main window (that opens a popup) to set in popup window:
1. global variables
2. form fields
Yes.
For example, I'm opening popup window like below:
categories=wind ow.open(address ,"categories"," scrollbars=no,h eight=400,width =
600");

Then I try to set global variable in popup window:
categories.glob al_variable = 1; //no effect

Or try to set form field:
categories.docu ment.some_form. some_filed.valu e = "some value"; //no effect
You have to wait for the page in the popup window to load.
If none of above won't work, how could I pass some data to another window
using JS?


You are doing it correctly, but it only works when the page is loaded
(or at least has loaded to the point where the form and form field
exists).

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2
Lasse Reichstein Nielsen wrote:
You are doing it correctly, but it only works when the page is loaded
(or at least has loaded to the point where the form and form field
exists).


So, how can I check if form field has been already loaded?
--
Greets
adeon
Jul 20 '05 #3
Adam Dyga wrote:
Lasse Reichstein Nielsen wrote:
You are doing it correctly, but it only works when the page is loaded
(or at least has loaded to the point where the form and form field
exists).


So, how can I check if form field has been already loaded?


To be sure:

if (referenceToWin dow
&& !referenceToWin dow.closed
&& referenceToWind ow.document
&& referenceToWind ow.document.for ms
&& referenceToWind ow.document.for ms["foo"]
&& referenceToWind ow.document.for ms["foo"].elements
&& referenceToWind ow.document.for ms["foo"].elements["bar"]
&& typeof
referenceToWind ow.document.for ms["foo"].elements["bar"].value !=
"undefined" )
{
/*
* do something with
* referenceToWind ow.document.for ms["foo"].elements["bar"].value
*/
}

Untested, HTH.
PointedEars
Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
3565
by: Mosher | last post by:
Hello all, is there any way to send php variables to another popup html window? I just want users to be able to click on a hyperlink like this... e.g., <a target=new href="www.mydomain.com/main.php?username=test&id=50> click here </a> ....that will popup another window. This new window should be able to use those variables. Thanks in advance.
9
3648
by: Pack Fan | last post by:
I've noticed that session variables will persist on Mac IE even after all browser windows have been closed. One must quit the program to clear the session variables. This presents a security risk for my session variable based security scheme. Basically, the risk is that a user will login to my site, close the window when done and allow someone else to come up to the machine, go back to my site and be logged into the previous user's...
2
1705
by: lawrence | last post by:
I thought I was fighting a PHP problem, so I asked about this on a PHP list, but they felt it was a Javascript problem, so I'm reposting a bit of the debate here. Could this Javascript, below, possibly trigger a redirect in Netscape, and send the browser to a file called "0". Cause what is happening is on load, in Netscape, the page redirects to something like: http://www.myDomain.com/0
2
11127
by: Hasan Ammar | last post by:
Is it possible to set up hotkeys using onkeypress? I know it can be done with the usual alphanumeric keys, but what about function keys? or using ctrl/alt combinations? Does anybody have a tutorial/guide?
7
1435
by: danny | last post by:
Hello everyone, How can I go about setting a number of variables using a table which will have the variable names to be declared in one table. The data to be assigned will reside in another. As an example, I know this assignment works: var nam0 = tab var nam1 = tab var nam2 = tab ..
2
2722
by: Chris | last post by:
Hi, I'm new to ASP.Net and Crystal but I've been playing with some samples and have run into a problem. If I put all my code into the Page_Init sub of a single form and run that form, the Crystal report runs fine. Now i am trying to create another web form where I can input parameters, hit submit and have those parameters passed to the second
1
6509
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting" setting to be "E_ALL", notices are still not getting reported. The perms on my file are 664, with owner root and group root. The php.ini file is located at /usr/local/lib/php/php.ini. Any ideas why the setting does not seem to be having an effect? ...
1
1616
by: phoenix917 | last post by:
I have been working on this code for 5 days... I have read multiple tutorials and looked at various code. This is my third forum try... :) My instructor refuses to help me. I think it's because I'm a good student. They assume you know it all. :) Well, I don't and I'm getting a little frustrated and wonder if you guys can shed some light? It's an 8 ball. It works. I've tested and tested but can't find where to put the oldQuestion...
1
1171
by: jwestin | last post by:
Hi, I have a main window that opens another window, that i would like to have as "datastorage". The second window will have variables that should be set from the first window. Finally I would like to be able to read the variables from window two from a third window (as well as from the first). I haven't found out how this is done in javascript. Anyone can give a short simply example? Thanks Jörgen
0
9632
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10136
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9925
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8958
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6723
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5372
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5501
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4036
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2867
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.