PDA

View Full Version : DHTMLmodal window won't close



marcusbmig
02-12-2012, 07:13 PM
1) DHTML Modal window v1.1

2) http://www.dynamicdrive.com/dynamicindex8/dhtmlwindow/dhtmlmodal.htm

3) I am using this script on
www.tremyfoel.co.uk
on this home page its working.
I then set up a page
www.tremyfoel.co.uk/linkpopup2.htm
with the code to allow others to use the interactive map. When this code is pasted into another page - SEE
http://www.probusllandudno.org.uk/windowtest.htm
- this works BUT for some reason the pop up window (the map) won't close when the X is clicked - seems to reload? I get an error msg (in IE) error modal.js line 55 char 2 - which is the close function.
NB the dhtmlwindow.js was renamed dhtmlwindow1.js when I edited the urls to the graphics files to full urls thats the only difference
NB2 the css is all in javascripts.css
Can't see what the problem is any help appreciated.

ddadmin
02-12-2012, 09:13 PM
This is due to the page you're trying to open inside the modal window being from a different domain than the page opening it. By default the script tries to access the document object of the former, which in this case throws an error.

Try the below modified modal.js file, which silently suppresses this error in such an event.

marcusbmig
02-13-2012, 12:29 AM
I have tested this and the problem looks like its solved - well done. I understand entirely the cause of the error now that you have identified it but my javascript knowledge not enough to fix it.
Bravo sir!