Window. showModalDialog application, showmodaldialog
1. parameter transfer
VArguments is used to pass parameters. The type is unlimited. For string types, the maximum value is 4096 characters. You can also pass objects.
Example:
A.htm
<Script> window. showModalDialog ("B .htm", "This is a parameter value", "help: no; scroll: no"); </script>
B .htm
<Script> alert ("the value passed through interface A is:" + window. dialogArguments); </script>
2. Return Value
You can use window. returnValue to return information to the parent window (that is, to open the modal window) or an object.
Example:
A.htm
<script> result=window.showModalDialog("B.htm","","help:no;scroll:no"); alert(result);</script>
B .htm
<Script> window. returnValue = "store returned results here"; </script>
3. Prevent opening a new window after submission in the modal window
Before <body> on the page, add
<base target="_self">
4. Call the parent window method and PASS Parameters
A.htm
<Script> function show () {// method of the a window alert ("show");} var arg = new Object (); // The parameter arg to be passed. win = window; // input the reference of window A as the parameter into arg. str = "argument"; // other parameters to be passed in window. showModalDialog ("B .htm", arg, 'help: no'); </script>
B .htm
<Script> var arg = window. dialogArguments; alert (arg. str); arg. win. show (); // call the method of window A </script>