Showmodaldialog and showmodelessdialog usage

Source: Internet
Author: User

1. Similarities and Differences between showmodaldialog and showmodelessdialog

The two pop-up forms cannot be refreshed.

Exception: the former is a modal window and always obtains the focus. The latter is a non-modal window, but a page is displayed, and the parent window can be operated.

2. Close the showmodaldialog and showmodelessdialog pop-up windows.

<Input type = "button" value = "buttonclick" onclick = "self. Close ();">

3. How can I operate the button in the new window of showmodaldialog and showmodelessdialog, but not the new window?

Add <base target = "_ Self"> between

4. Return Value of showmodaldialog

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>

Window. Close close the window. Close the window without a system prompt.

When we use this method: Response. Write ("<SCRIPT> window. Close () </SCRIPT> ")
Always Prompt: the prompt that the webpage you are viewing is trying to close
How do I remove the prompt and close the form directly?
You can use the following methods:
Response. Write ("<SCRIPT> window. Opener = NULL; window. Close () </SCRIPT> ")
Only IE6 is supported.
Opener can be set to any value without any prompt

How can I close a parent form through a child form?
Subform (pop-up form ):
Likewise:
Response. Write ("<SCRIPT> window. opener. Top. Opener = NULL; window. opener. Top. Close () </SCRIPT> ")

<Object ID = HH1 classid = "CLSID: ADB880A6-D8FF-11CF-9377-00AA003B7A11">
<Param name = "command" value = "minimize"> </Object>
<Object ID = HH2 classid = "CLSID: ADB880A6-D8FF-11CF-9377-00AA003B7A11">
<Param name = "command" value = "maximize"> </Object>
<Object ID = hh3 classid = "CLSID: adb880a6-d8ff-11cf-9377-00aa003b7a11">
<Param name = "command" value = "close"> </Object>

<Input type = button value = minimized onclick = hh1.click ()>
<Input type = button value = maximized onclick = hh2.click ()>
<Input type = button value = Disable onclick = hh3.click ()>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.