Checking for element...

J

jodleren

Hi

In a popup window (by a button) I use this to pass data on to the
parent window:

window.opener.document.forms[0].receivers.value=sellist;

I have tried to check for the receiveres element, type=text, but... so
far without luck.... how can I do that?

/S
 
M

Martin Honnen

jodleren said:
In a popup window (by a button) I use this to pass data on to the
parent window:

window.opener.document.forms[0].receivers.value=sellist;

I have tried to check for the receiveres element, type=text, but... so
far without luck.... how can I do that?

What exactly do you want to check? Whether that particular control is of
type text?
if (window.opener && ! window.opener.closed) {
var control = window.opener.document.forms[0].receivers;
if (control && control.type == 'text') {
...
}
}
 
J

jodleren

jodleren said:
In a popup window (by a button) I use this to pass data on to the
parent window:
window.opener.document.forms[0].receivers.value=sellist;

I have tried to check for the receiveres element, type=text, but... so
far without luck.... how can I do that?

What exactly do you want to check? Whether that particular control is of
type text?

In case the user has clicked away on the opener window. Then there
might be a form etc, but not the one which I just had.
I wonder whether I should check for the form name too.
   if (window.opener && ! window.opener.closed) {
     var control = window.opener.document.forms[0].receivers;
     if (control && control.type == 'text') {
       ...
     }
   }
 
M

Martin Honnen

jodleren said:
In case the user has clicked away on the opener window. Then there
might be a form etc, but not the one which I just had.
I wonder whether I should check for the form name too.

Yes, do that.
 
T

Thomas 'PointedEars' Lahn

jodleren said:
jodleren said:
In a popup window (by a button) I use this to pass data on to the
parent window:
window.opener.document.forms[0].receivers.value=sellist;
I have tried to check for the receiveres element, type=text, but... so
far without luck.... how can I do that?
What exactly do you want to check? Whether that particular control is of
type text?

In case the user has clicked away on the opener window. Then there
might be a form etc, but not the one which I just had.
I wonder whether I should check for the form name too.

It would be better if you stored a reference to the form object when the
popup is opened and on access compare whether or not the collection item
and the previously stored reference are identical. With names, there is
no guarantee; anybody may use the same names as you do. With object
references, there is the guarantee that two separate objects themselves
are never the same; they have identity.


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,145
Messages
2,570,826
Members
47,373
Latest member
Desiree036

Latest Threads

Top