Is it possible to close a modal window from it with the parent? Itβs hard to even try to do it. Basically, I open a modeless window. From this modeless window the user can open the modal window several times. Now suppose I close a modeless window ... I would also like to close the modal subtitle. How can I do that?
In general, in general, I need to find a way to close the modal window from it with the parent.
Thanks Grae
Here is some code that will give you a sample.
home page
<html>
<head>
<script>
window.childWindow;
function openNonModal()
{
window.childWindow = window.open("nonmodal.html","_blank", "dialogWidth=500px;dialogHeight=294px;scroll=no;status=no;caption=no;titlebar=no;menubar=no;toolbar=no;help=no");
setTimeout("closeChildWindow()",5000);
}
function closeChildWindow()
{
window.childWindow.closeChildWindow();
window.childWindow.close();
}
<script>
</a> < input type="button" value = "openNonModal" onclick = "openNonModal(); return false;" /">
</HTML>
code>A modeless window that opens a modal window.
<html>
<head>
<script>
function openModal()
{
var retVal = window.showModalDialog("modal.html","_blank", "dialogWidth=500px;dialogHeight=294px;scroll=no;status=no;caption=no;titlebar=no;menubar=no;toolbar=no;help=no");
}
function closeChildWindow()
{
alert("should close child window");
}
</script>
</a> < input type="button" value = "openModal" onclick = "openModal(); return false;" /">
</HTML>
code>A modal window is just text.
<html>
Just a sample.
</html>
source
share