PDA

View Full Version : Dhtml closeit() function



kmclaurin
10-21-2005, 03:57 PM
Hello, I am looking for help with :
DHTML Window
http://www.dynamicdrive.com/dynamicindex8/dhtmlwindow.htm

I am trying to call the closeit() function with a link :
<a href = "javascript:closeit()">Return to list </a> and
get an error on first line in the function :
document.getElementById("dwindow").style.display="none"

Is there a syntax I can use from a link to do this?
Many thanks!

ddadmin
10-21-2005, 06:14 PM
If you're calling closeit() from within the DHTML window (ie: the link is inside the DHTML window), you'll need to use something like:


<a href="javascript:parent.closeit()">Close</a>

Important: The above code will only work inside the DHTML window if that page is from the same domain as the main page calling the window. If not, a security error will occur, as JavaScript cannot cross over to a different domain than the one it's on.

kmclaurin
10-22-2005, 12:41 AM
Thanks...that's what I needed