473,385 Members | 1,843 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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 6508
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Tony Farrell | last post by:
Hi Everyone - I have a data entry form that allows the user to click a button and have that button popup a list of available values - the code on the popup window uses the name of the form to...
1
by: Martin John Brindle | last post by:
Is it possible to return a value from a popup window? I really need something that can do this and the behaviour of the createpopup method is perfect except i can't work out how to return a value....
4
by: Davey | last post by:
I have a website which has a popup window (this only opens when the user chooses to open it). In the popup window I have a <select> control which lists a selection of "classes". Each class has a...
4
by: wrytat | last post by:
I have a form with a textbox for the user to enter a quantity and another textbox for the delivery date. I disabled this delivery date textbox such that the user has to press a calendar link next...
1
by: ABC | last post by:
I has a parent and a popup lookup ASP.NET Form. Both has javascript. I test the popup window's window.Form1.SelectedProductCode.value has a value. But don't know why the return variable "retvar"...
5
by: knowdotnet | last post by:
Hi all, Which is the best way to return a value back to the web page from a pop up page? I have a asp.net web application which opens a popup page on a link button click. The Link button is...
4
by: neena | last post by:
Hi I am uing C#.net & using javacript for a popup window. I've a form and there is a button named Categories. When it is clicked, it will open a new window for the selection of categories. When...
1
by: VMI | last post by:
How can I transfer some text from a Textbox in a popup window to the main webform that opened that popup? The popup webform will have some type of Button that the user will click in order to...
1
by: pandharinath | last post by:
I want to display fields(row) selected from grid in popup window to textboxes in Opener window. I have written code as follows : Main Opener window protected void Button1_Click(object...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.