PDA

View Full Version : dhtml window widget return value



edhrx
04-04-2008, 03:42 PM
Just starting evaluating this and is looking good.

However, I need to be able to get back a value from the page that was displayed in the diaglog when the dialog closes...is it possible to do that.

That value could be anything integer string javascript array

best wishes ed.

ddadmin
04-04-2008, 08:21 PM
Warning: Please include a link to the DD script in question in your post. See this thread (http://www.dynamicdrive.com/forums/showthread.php?t=6) for the proper posting format when asking a question.

Well, the onclose event handler lets you execute code when a DHTML window is closed. The variable you assigned to when calling dhtmlwindow.open() contains a DOM reference to that window, so you can use that to then access anything within the DHTML that was closed, for example:


var mywin=dhtmlwindow.open("sitebox", "ajax", "mypage.htm", "#1: My Web site", "width=590px,height=350px,resize=1,scrolling=1,center=1", "recal")

mywin.onclose=function(){ //Run custom code when window is being closed (return false to cancel action):
alert(mywin.innerHTML) //alert contents of window
return true
}

If you're using the IFRAME mode (instead of say Ajax like above), the page shown must be on your own domain, as you can't access info from a off site page.