Pass selected <TD> value from child to parent window

F

Filiz Duman

Hi,

I am opening a pop up window (child) from a parent window.
The Child window does show a table with multiple columns and rows, each
showing a value, e.g. 9 or 10 or etc. I have the values as hyperlinks, so
that if a number is selected in the child window it should close
automatically and insert the selected value in a text field in the parent
window.
I have created following code, but does not work.
Any ideas why or other approaches ?
Thanks.

that is how I open the child window:

newwindow = window.open("0to100kbs.htm" , "popup1",
"width=350,height=350,screenX=200,screenY=200,top=200,left=200",
"alwaysRasied");

my table data in the child window:
"..... <TD><a href="#" onClick="sendInfo (this.innerHTML);">5</a></TD>"

and the javascript on the child window:

function sendInfo(name) {
window.opener.document.6Cos.ef.value = name;
self.close(); }
where as 6Cos is the form name in my parent window and ef the text field
name.
 
Y

Yann-Erwan Perio

Filiz said:
I am opening a pop up window (child) from a parent window.
The Child window does show a table with multiple columns and rows, each
showing a value, e.g. 9 or 10 or etc. I have the values as hyperlinks, so
that if a number is selected in the child window it should close
automatically and insert the selected value in a text field in the parent
window.
window.opener.document.6Cos.ef.value = name;

I think that the name "6Cos", while valid HTML, might be the problem, at
least as you reference it; an identifier starting with a number in
javascript, cannot indeed be referenced using the dot notation.
Therefore, you need to use the square bracket notation, or to change the
identifier's name.

window.opener.document.forms["6Cos"].elements["ef"].value = name;


HTH
Yep.
 

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

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top