PDA

View Full Version : Trouble with DHTML window widget



Seannal
06-10-2008, 10:52 AM
1) Script Title: DHTML Widget

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

3) Describe problem:

All I am trying to do is add a simple text link to close the window.

You can see my popup in action here: www.musclegaintruth.com

Based on this coding I was told to use:

<a href="#" onClick="popwindow.close(); return false">Close Window</a>

I did this but when I click the text link I just get "error on page" at the bottom and the window just stays open.

I had a guy slightly modify this script for me a while back to accomodate the video inside (the sound of the video would continue to play despite closing the window), and so I'm thinking maybe this is interfering somehow.

Can someone please take a quick look at my page and tell me what I need to do to get the window to close with a text link?

Any help would be awesome,

Thanks,

Sean

Seannal
06-11-2008, 08:52 AM
Anyone?

ff123
06-11-2008, 12:15 PM
you have to post HELP.. HELP.. HELP.. four five times then somone could help.. I'm sorry i don't know anything about it but just letting you know how everyone behaves here..

ddadmin
06-11-2008, 06:51 PM
you have to post HELP.. HELP.. HELP.. four five times then somone could help.. I'm sorry i don't know anything about it but just letting you know how everyone behaves here..

Actually, everyone here behaves like they should, which is help out as much as possible as time permits. There will always be gaps in the response times when our schedules are more busy than usual, like this week for me.

To the OP's question, I don't see a "Close" window link on your page now to test out. But if popwindow.close() doesn't work for some reason, try popwindow.hide() instead.

Seannal
06-11-2008, 09:52 PM
In my experience everyone on this board is extremely kind and helpful...Sorry I bumped my own post but I really want to get this solved asap.

So I tried using:

<a href="#" onClick="popwindow.hide(); return false">Close</a>

But it still won't work... I took the close link off the popup since it wasn't working but have left it on temporarily.

Popup at www.musclegaintruth.com

Popup contents at www.musclegaintruth.com/windowcontents-test.htm

Any thoughts?

ddadmin
06-11-2008, 10:15 PM
I see the problem. You're putting the Close link inside the DHTML window via IFRAME mode. That means it's actually on a separate page. Due to this, you need to access close() in the parent window's document that actually contains the script:


<a href="#" onClick="parent.popwindow.hide(); return false">Close [X]</a>

Seannal
06-11-2008, 10:55 PM
Thanks - I made the change to the code, and the link now closes the popup in firefox, but for some reason in IE it still gives me the error message.

ddadmin
06-11-2008, 11:00 PM
Make sure IE isn't caching the page inside the IFRAME. To check, view source for the page inside the IFRAME, and see if the link has been updated correctly.

Seannal
06-11-2008, 11:09 PM
Yup, I did this and checked and the link is updated properly but still getting the error.

ddadmin
06-12-2008, 09:13 PM
Ok I see the problem- it's a permission error in IE. Basically, on your main page, you're calling dhtmlwindow.open() with an absolute URL to the page:


popwindow=dhtmlwindow.open("popwindow", "iframe", "http://musclegaintruth.com/windowcontents-test.htm", "ACCESS YOUR FREE GIFT BELOW!", "width=462px,height=379px,resize=0,scrolling=0,center=1","recal")

Try changing that to a relative URL:


popwindow=dhtmlwindow.open("popwindow", "iframe", "windowcontents-test.htm", "ACCESS YOUR FREE GIFT BELOW!", "width=462px,height=379px,resize=0,scrolling=0,center=1","recal")

Seannal
06-12-2008, 09:48 PM
Bingo.

Thanks so much for your help!!

Sean