1) Script Title:
DHTML Window Widget
2) Script URL (on DD):
http://www.dynamicdrive.com/dynamici...ndow/index.htm
3) Describe problem:
Is it possible to reach up from the DHTML Window and execute a JS function which is on the parent page?
1) Script Title:
DHTML Window Widget
2) Script URL (on DD):
http://www.dynamicdrive.com/dynamici...ndow/index.htm
3) Describe problem:
Is it possible to reach up from the DHTML Window and execute a JS function which is on the parent page?
This is only applicable if you're using the IFRAME mode. Within the DHTML window page, you can call a function within the parent window using something like:
where dothis() is the function in the parent window. Same idea with variables as well.Code:parent.dothis()
tiiiim (05-14-2008)
Ah ... I should have guessed. Thanks!
Can this be done the other way round too? As in, click something on the parent page to change a div or form value on the pop-up? So far I'm not having any luck!!
Yes ... presuming you have a VAR that is a hanlde to teh window you can use someting like:
winHandle.contentDoc.getElementById("textbox").value = "Joe";
This works if the window is a MODAL window ... not sure about the regular one.
Of course If you're using the IFRAME mode to open a window, for example:
The page inside the DHTML window can be accessed using the syntax:Code:var mywin=dhtmlwindow.open("pagebox", "iframe", "test.htm", "#1: Contact Info", "width=590px,height=350px,resize=1,scrolling=1,center=1")
Notice the matching ID attributes in red. So for example:Code:window.frames["_iframe-pagebox"]
Code:alert(window.frames["_iframe-pagebox"].document.body.innerHTML)
tiiiim (05-14-2008)
Just like to confirm that the
method works perfectly.Code:window.frames["_iframe-uniqueID"]
I did have some reservations as I'd read somewhere else that this wouldn't work in Firefox, but it works fine (I'm use FF3 Beta 5, so not sure about the previous versions...)
Thanks!!
Bookmarks