views:

43

answers:

2

I want to set label's value from popup.But label is in frame and I dont know how to achieve it from popup. From parent page,i get this label by following javascript function.

But when I use this function in popup page, I cant find topframe.Do u have any solution about how to success it?

if (window.parent.document.getElementById('lbl')) 
{
    window.parent.document.getElementById('lbl').innerText = sender.getSelectedItem().get_text();
}
else
{ 
    window.parent.frames['topFrame'].document.getElementById('lbl').innerText = sender.getSelectedItem().get_text();
}
A: 
window.parent

refers to your popup-window itself.

Try

opener.frames['topFrame'].document.getElementById()

instead - 'opener' refers to your main-window out of a popup.

Olaf Watteroth
Unfortunately doesnt work :(
cem
when i want to get window.opener in debug windows,i see that it is undefined.
cem
Not "window.opener": just "opener". Maybe it's needed that you open it like "var myWindow = window.open("url");"
Olaf Watteroth
Just opener doesnt work too,it says undefined.I open my popup by modalpopup maybe it doesnt work cause of modalpopup...
cem
window.parent.top.frames.document..that works
cem
Somehow strange - my popup works fine with opener and my german source for javascript (http://de.selfhtml.org) also says so. But cool that you found a solution :-) Maybe it's really modalpopup...
Olaf Watteroth
A: 

window.parent.top.frames.document works

cem