By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,365 Members | 3,180 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,365 IT Pros & Developers. It's quick & easy.

get a value from a popUp window

P: n/a
Hi, I'm using the folowing javascript code to oprn a popUp window
msgWindow=window.open('','messageWindow', 'scrollbars=yes,width=300,
height=150');
msgWindow.document.open();
msgWindow.document.write(strHTML);
msgWindow.document.close();

In this window I've a form containing a text TXTNAME and a button that call
another function javascript popUpProcess()

How can I get the value of TXTNAME inside the function popUpProcess()?
I've tried message"Window.forms[0].TXTNAME .value" but it doesn't work.

Thanks.

Jul 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
On Wed, 3 Mar 2004 16:42:27 -0500, toufik toufik <to*****@sympatico.ca>
wrote:
Hi, I'm using the folowing javascript code to oprn a popUp window
msgWindow=window.open('','messageWindow', 'scrollbars=yes,width=300,
height=150');
[snip]
How can I get the value of TXTNAME inside the function popUpProcess()?
I've tried message"Window.forms[0].TXTNAME .value" but it doesn't work.


"messageWindow" is the name of the window with regard to target
attributes. That is, target="messageWindow" on a link will open the page
in the popup window. msgWindow is what you want to use: it contains a
reference to the new window.

If you must use a popup window, you should allow users to resize it:

msgWindow = window.open('','messageWindow',
'scrollbars,resizable,width=300,height=150');

Then:

msgWindow.document.forms[0].TXTNAME.value

to reference the value.

Mike

--
Michael Winter
M.******@blueyonder.co.invalid (replace ".invalid" with ".uk" to reply)
Jul 20 '05 #2

P: n/a
Thanks Mike,
But it doesn't work, I find that it works with this syntax
window.document.forms[0].TXTNAME .value

Now I can access the inputs of the original page

here is my case:
I've a page that contains a button, in the ONCLIC event I open the popUp
window, in the onClic event of the popup window I call a javascript function
where I assign the value entred in the popup to a text in the original page.

Thanks
"Michael Winter" <M.******@blueyonder.co.invalid> wrote in message
news:op**************@news-text.blueyonder.co.uk...
On Wed, 3 Mar 2004 16:42:27 -0500, toufik toufik <to*****@sympatico.ca>
wrote:
Hi, I'm using the folowing javascript code to oprn a popUp window
msgWindow=window.open('','messageWindow', 'scrollbars=yes,width=300,
height=150');


[snip]
How can I get the value of TXTNAME inside the function popUpProcess()?
I've tried message"Window.forms[0].TXTNAME .value" but it doesn't work.


"messageWindow" is the name of the window with regard to target
attributes. That is, target="messageWindow" on a link will open the page
in the popup window. msgWindow is what you want to use: it contains a
reference to the new window.

If you must use a popup window, you should allow users to resize it:

msgWindow = window.open('','messageWindow',
'scrollbars,resizable,width=300,height=150');

Then:

msgWindow.document.forms[0].TXTNAME.value

to reference the value.

Mike

--
Michael Winter
M.******@blueyonder.co.invalid (replace ".invalid" with ".uk" to reply)

Jul 20 '05 #3

P: n/a
On Wed, 3 Mar 2004 17:50:25 -0500, toufik toufik <to*****@sympatico.ca>
wrote:
But it doesn't work, I find that it works with this syntax
window.document.forms[0].TXTNAME .value


[snip]

I assumed that you were trying to access the control, TXTNAME, that is in
the popup window from the opener window. In that case, you would need to
reference the popup like I demonstrated. As you're accessing the control
from within the same window, the expression below is sufficient.

document.forms[0].TXTNAME.value

My mistake.

Mike
Please don't top-post.

--
Michael Winter
M.******@blueyonder.co.invalid (replace ".invalid" with ".uk" to reply)
Jul 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.