PDA

View Full Version : DHTML windows - reload, child, and totally independent window



Usagi
09-30-2011, 03:11 AM
1) Script Title: DHTML Window widget (v1.1)

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex8/dhtmlwindow/

3) Describe problem: I love the script. It really saves my bacon by replacing the javascript popups that I had on my site and that were often blocked. Thanks for this wonderful script.

Three problems:
1) When the popup is closed, I'd sometimes like to repaint the page under. For example: http://www.prose-n-poetry.com/display_work/10539
When someone posts a comment, the page needs to repaint so the new comment is visible. I tried this but it doesn't work:
<a href="javascript:window.location.reload(); parent.comment.close()"><b>Close Window</b></a> It closes the window but doesn't repaint the page.

2) I would like a link inside one popup that launches another popup. So far, all I can get is that the new popup appears inside the existing one that launches it. If you look at the bottom of the above link, you'll see "Contact Us" Click on that and you'll get a DHTML window. Inside that there is a link that says "Speller Help" Click on that and you get the old style popup. I'd like it to create another DHTML window to replace the help popup.

3) This one may be impossible. I have a midi music player on the site. If you click "Midi Musicbox" at the top of any screen, a small midi player pops up. It plays midi's randomly. It acts independently of the site. As you go from page to page, the music player is totally unaffected. The DHTML windows are MUCH cleaner and unstoppable. I'd prefer to use those but as soon as I bounce around the site, the player starts anew with each page change.

Thanks for your anticipated help.

Usagi
09-30-2011, 06:14 PM
I did find a solution to re-loading the original screen:
<script language="JavaScript">window.parent.document.location.reload(); parent.hidecomment.close();</script>
That closes the window and reloads the original page to show changes made in the window by a form.

ddadmin
09-30-2011, 10:27 PM
To answer your questions:

1) Try changing your original close window code to the following:


<a href="javascript:parent.comment.close();parent.location.reload()"><b>Close Window</b></a>

2)
I would like a link inside one popup that launches another popup. To do this, on the main page (not the page inside popupA), define the function that when called will launch the desired popup window (popupB), for example:


function openwindow(){
var popupB=dhtmlwindow.open("googlebox", "iframe", "http://images.google.com/", "#1: Google Web site", "width=590px,height=350px,resize=1,scrolling=1,center=1", "recal")
}

Then inside the page of popupA, you can invoke openwindow(), defined on the main page to launch popupB, by using the syntax:


<a href="javascript:parent.openwindow();"><b>Spell Check</b></a>

The keyword "parent" is what lets you navigate back up to the parent (main) window, and access any JavaScript variable/methods contained in it.

3) Hmm as you suspected a DHTML window (unlike a regular window) is part of the page, and cannot persist from one page to another. Anything playing it will get erased as soon as the user hops to another page.