ASP. NET pop-up form always top-level method

Source: Internet
Author: User

Method 1,

Add the following event to the body on the pop-up page.

< Body Onblur = "This. Focus ();" Onload = "This. Focus ();" >

When the Form loses focus, the focus is immediately retrieved. The components on the page after the pop-up window cannot be clicked.

The disadvantage of this method is that content cannot be entered on the page.

 

Method 2: Use showmodaldialog

ExampleCode:

< Script Language = " Javascript " Type = " Text/JavaScript " >
Function Opentopdialog ()
{
Window. showmodaldialog (
' Show. aspx ' , Null , ' Resizable: Yes; scroll: Yes; Status: No; dialogwidth: 800px; dialogheight: 600px; center = yes; help = No ' );
}
< / SCRIPT>

Question 1:

OpenShowmodaldialogWhen disabled, a blank page is displayed.

Solution:ShowmodaldialogIn the header of the page.<Base target = "_ Self">.

Question 2:

ShowmodaldialogThe link is enabled in the new window.

Solution:

OpenShowmodaldialog<Base target = "_ parent">

ShowmodaldialogThe usage is as follows:

Vreturnvalue = Window. showmodaldialog (Surl [, varguments] [, sfeatures])
Vreturnvalue = Window. showmodelessdialog (Surl [, varguments] [, sfeatures])

Parameter description:

Surl

Required parameter. Type: string. Specifies the URL of the document to be displayed in the dialog box.
Varguments
Optional parameter; Type: variant. Used to pass parameters to the dialog box. The passed parameter types are not limited, including arrays. The dialog box uses window. dialogarguments to obtain the passed parameters.
Sfeatures
Optional parameter; Type: String. Used to describe the appearance and other information of the dialog box. You can use one or more of the following, separated by semicolons.
In the dialogheight dialog box, the height is not smaller than PX. In ie4, the default unit of dialogheight and dialogwidth is em, while in ie5, the default unit is PX. For convenience, When you define the modal mode dialog box, unit with PX.
Dialogwidth: Dialog Box width.
Dialogleft: The left distance from the desktop.
Dialogtop: the distance from the desktop.
Center: {Yes | no | 1 | 0}: whether the window is centered. The default value is yes, but the height and width can still be specified.
Help: {Yes | no | 1 | 0}: whether to display the Help button. The default value is yes.
Resizable: {Yes | no | 1 | 0} [ie5 +]: whether the size can be changed. No by default.
Status: {Yes | no | 1 | 0} [ie5 +]: whether to display the status bar. The default value is Yes [modeless] or no [modal].
Scroll: {Yes | no | 1 | 0 | on | off}: Specifies whether the scroll bar is displayed in the dialog box. The default value is yes.

There are also several attributes used in HTA, which are generally not used in general web pages.
Dialoghide: {Yes | no | 1 | 0 | on | off}: whether the dialog box is hidden when printing or previewing. The default value is no.
Edge: {sunken | raised}: Specifies the border style of the dialog box. The default value is raised.
Unadorned: {Yes | no | 1 | 0 | on | off}: No by default.

 

 

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.