It turns out that this business of skipping the onclose event is a feature so that folks can dismiss the window without doing anything if they hit the x.
Just by adding this (red) to modal.js file near the bottom:
Code:
forceclose:function(t){ //function attached to default "close" icon of window to bypass "onclose" event, and just close window
dhtmlwindow.rememberattrs(t) //remember window's dimensions/position on the page before closing
t.style.display="none"
this.veilstack--
if (this.veilstack==0) //if this is the only modal window visible on the screen, and being closed
this.interVeil.style.display="none"
if(t.onclose)
t.onclose();
},
Took care of it in IE 7 for the demo I already gave you. However, Opera would only 'fall for that' once. So, I had to add to the demo .htm file for opera:
Code:
<script type="text/javascript">
var ftg;
function opentrailer(){
ftg=dhtmlmodal.open("movietrailer", "iframe", "http://www.questable.com/ftg.html", "Facing The Giants", "width=460px,height=360px,center=1,resize=1,scrolling=0")
ftg.onclose=function(){ //Define custom code to run when window is closed
document.getElementsByTagName('iframe')[0].setAttribute('src', 'about:blank', 0);
if(window.opera&&!ftg.cv){
ftg.cv=1
opentrailer()
dhtmlmodal.close(ftg);
setTimeout("ftg.cv=0", 1000);
}
return true;
}
}
opentrailer()
</script>
I change src= to setAttribute but, that made no difference, it works either way.
So, after changing modal.js, I came up with this page that worked in all three browsers:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<link rel="stylesheet" href="windowfiles/dhtmlwindow.css" type="text/css" />
<script type="text/javascript" src="windowfiles/dhtmlwindow.js">
/***********************************************
* DHTML Window Widget- © Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for legal use.
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/
</script>
<link rel="stylesheet" href="modalfiles/modal.css" type="text/css" />
<script type="text/javascript" src="modalfiles/modal.js"></script>
</head>
<body>
<script type="text/javascript">
var ftg;
function opentrailer(){
ftg=dhtmlmodal.open("movietrailer", "iframe", "http://www.questable.com/ftg.html", "Facing The Giants", "width=460px,height=360px,center=1,resize=1,scrolling=0")
ftg.onclose=function(){ //Define custom code to run when window is closed
document.getElementsByTagName('iframe')[0].setAttribute('src', 'about:blank', 0);
if(window.opera&&!ftg.cv){
ftg.cv=1
opentrailer()
dhtmlmodal.close(ftg);
setTimeout("ftg.cv=0", 1000);
}
return true;
}
}
opentrailer()
</script>
<a href="#" onclick="opentrailer(); return false">View Trailer</a>
</body>
</html>
Bookmarks