473,471 Members | 1,981 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Problems between children and parents windows

Hi,

I'm trying to pass values from a parent window to a child. The value
I'm interested is the user selected option of a SELECT element, as
follows:

<input type='button' value='Asigna valor' name='valor' align='left'
onClick=window.open('valor.jsp?variable=documents. forms[0].variable.options[document.forms[0].variable.selectedIndex].value','child','resizable=yes,scrollbars=yes,stat us=no,toolbar=no,width=350,height=200,menubar=no,d irectories=no,dependent=yes,hotkeys=1,alwaysRaised =1');></td>

I think the mistake is in the way I'm passing the value:

valor.jsp?variable=documents.forms[0].variable.options[document.forms[0].variable.selectedIndex].value

Could you, please, help me to figure it out?

TIA.
Jul 23 '05 #1
2 4883
Omar wrote:
Hi,

I'm trying to pass values from a parent window to a child. The value
I'm interested is the user selected option of a SELECT element, as
follows:

<input type='button' value='Asigna valor' name='valor' align='left'
onClick=window.open('valor.jsp?variable=documents. forms[0].variable.options[document.forms[0].variable.selectedIndex].value','child','resizable=yes,scrollbars=yes,stat us=no,toolbar=no,width=350,height=200,menubar=no,d irectories=no,dependent=yes,hotkeys=1,alwaysRaised =1');></td>
I think the mistake is in the way I'm passing the value:

valor.jsp?variable=documents.forms[0].variable.options[document.forms[0].variable.selectedIndex].value
Could you, please, help me to figure it out?

TIA.


The url is a string - but the querystring parameter needs to be
extracted, and that takes JavaScript code, not a string. You could just
remove the code from the quotes, but, might as well un-clutter
things...

<input type="button" value="Asigna valor" name="valor" align="left"
onclick="var
s=documents.forms[0].variable,v=s.options[s.selectedIndex].value;window.open('valor.jsp?variable='+v,'child' ,'resizable=yes........

Might be better to move the whole thing into a global function.
Presumably you're extracting this data from window.location.search in
the pop-up. Can also pass data directly, programmatically, between
window objects.

Jul 23 '05 #2
RobB wrote:
[...]

The url is a string - but the querystring parameter needs to be
extracted, and that takes JavaScript code, not a string. You could just
remove the code from the quotes, but, might as well un-clutter
things...

<input type="button" value="Asigna valor" name="valor" align="left"
onclick="
var v = documents.forms[0].variable,
s = documents.forms[0].variable,v=s.options[s.selectedIndex].value;
Remind me why we do this. Seems that the value of a select is the
value of the selected option, or if not present, the text - unless
it's a multiple select, in which case other methods are required or
the option has a value but the text is required.

All the browsers I tested work as above, so why not:

var v = documents.forms[0].variable.value,
window.open('valor.jsp?variable=' + v,'...'

or

window.open('valor.jsp?variable='+documents.forms[0].variable.value,
'child',
'resizable=yes........

and depending on the value extracted from the form element, it may
also require escaping:

var v = encodeURI(documents.forms[0].variable.value)

Or perhaps the 'selectedIndex' stuff is required to support older
browsers?
window.open('valor.jsp?variable='+v,'child','resiz able=yes........

Might be better to move the whole thing into a global function.
Presumably you're extracting this data from window.location.search in
the pop-up. Can also pass data directly, programmatically, between
window objects.


Wow, no lecture on the evils of pop-ups! ;-)

--
Rob
Jul 23 '05 #3

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

Similar topics

0
by: Bill J. Vallance | last post by:
------=_NextPart_000_0057_01C35233.C0403930 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hello, I have been using Snitz forums on windows 2000 IIS5 and MySQL...
0
by: Michael Bourgon | last post by:
I installed Windows 2000 SP4 on my server this evening. We ran into an odd error, and (1) wanted to share, and (2) wanted to see if there were any other things I should be on the lookout for. ...
0
by: gmesmer | last post by:
Hello I have created an assembly to print a pdf document and I wrote some unit tests and everything works from within nuint and cruisecontrol.net. ( I am using C#) Next I have to put together a...
1
by: pataN | last post by:
I use csc /t:library scanControl.dll. Here I got some errors telling me that the compiler can't find the class library dll:s that I have referenced in my windows control project. I have added...
2
by: Jay | last post by:
Hi, I have created FTP class file in c#.net. When i try to access FTP server (on Windows XP) through command line or browser, i am easily able to access it. but when i try it through my code, i...
0
by: msalman | last post by:
Hey I created a windows service and added it to a setup project. The setup project should install the service and run it but for some reasons it doesn't install the service and gives following...
1
by: =?Utf-8?B?S0ZyaXR6?= | last post by:
Started having problems with popups yesterday. Have the popup blocker set on high. Have Trend Micro but it won't let me do a manual scan. Says it is in use. Also the windows automatic update under...
1
by: BobLewiston | last post by:
I tried to compile a Windows Forms Application in Visual C# 2008 Express with this source code from the CSharpSchool tutorial at Programmer's Heaven:using System; using System.Windows.Forms; using...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
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...
0
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 ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.