469,936 Members | 2,405 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,936 developers. It's quick & easy.

get a value from a popUp window

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
3 6358
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
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
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.

Similar topics

1 post views Thread by Martin John Brindle | last post: by
4 posts views Thread by wrytat | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.