This was also sorted out a long time ago, so I’ll post it too:
1. The similarities and differences between showModalDialog and showModelessDialog
are: the pop-up forms of the two cannot be refreshed
. The difference is that the former is a modal window and always gets focus; the latter is a non-modal window, but only pops up a page and can also operate the parent window.
2. Close the pop-up windows of showModalDialog and showModelessDialog
<INPUT type="button" value="ButtonClick" onclick="self.close();">
3. How can I operate buttons in the pop-up new windows of showModalDialog and showModelessDialog without popping up new windows?
Add <base target="_self"> between <head> and </head>
4. For the return value of showModalDialog,
refer to the example:
t1.html:
<script language="javascript">
function showpage()
{
alert(showModalDialog("t2.html"));
}
</script>
<input type="button" value="getval" onClick="showpage();">
t2.html
<HTML>
<HEAD>
<Script language="javascript">
<
function SetVal()
{
returnValue="abc";
close();
}
//-->
</Script>
</HEAD>
<BODY>
<input type="button" value="Btn1" onClick="SetVal();">
</BODY>
</HTML>