Home >Web Front-end >JS Tutorial >How to make the js pop-up window appear at the front_javascript skills

How to make the js pop-up window appear at the front_javascript skills

WBOY
WBOYOriginal
2016-05-16 17:29:171301browse

Specific steps:

Method 1: Add code in the pop-up window : onblur="self.focus()":



Method 2: Use the showModalDialog method to create a modal dialog box. Its parameter description is shown in Table 1.5.2.

Open the modal window


Method 3: Use the showModelessDialog method to create a modeless dialog box. Its parameters are exactly the same as those of the modal dialog box. Same, you can refer to Table 1.5.2.


Open a modeless window
Note:

Modal dialog boxes always maintain focus. You cannot switch windows unless you close the dialog box. A modeless dialog box does not always maintain focus, but it always remains on top.
Special Notes

This example is mainly the application of modal dialog box and modeless dialog box. You must pay attention to the similarities and differences between the two dialog boxes.
Table 1.5.2 Parameter list of showModalDialog method
Parameter value description


sURL is required. String. Specify the URL to load and display.
vArguments optional. String. Specifies variables to use when displaying the document. Any type of value can be passed using this parameter, including arrays containing multiple values. The dialog box can extract these values ​​from the dialogArguments property of the window object by calling the program. sFeatures optional. String. Specifies the window decoration of the dialog box. Use the values ​​below. Separate multiple entries with semicolons.
dialogHeight: sHeight sets the height of the dialog box
dialogLeft: sXPos sets the abscissa coordinate of the upper left corner of the dialog box relative to the desktop.
dialogTop: sYPos sets the vertical coordinate of the upper left corner of the dialog box relative to the desktop.
dialogWidth: sWidth sets the width of the dialog box.
center : yes | no | 1 | 0 | on | off specifies whether the dialog box is displayed in the center of the desktop. The default value is yes .
dialogHide : yes | no| 1 | 0 | on | off specifies whether the dialog box is hidden when printing or print preview. This parameter is only available when the dialog box is opened by a trusted program. The default value is no .
edge : sunken | raised specifies whether the dialog window border style is sunken or raised. The default value is raised .
help : yes | no | 1 | 0 | on | off specifies whether the dialog box displays context-sensitive help icons. The default value is yes .
resizable : yes | no | 1 | 0 | on | off specifies whether the dialog box can be resized by the user. The default value is no .
scroll : yes | no | 1 | 0 | on | off specifies whether the dialog box displays scroll bars. The default value is yes .
status :<script><BR> function topwin(){<BR> window.showModalDialog(http://www.jb1.net,"","dialogWidth:300px;dialogHeight:300px;scroll:no;status:no")<BR> }<BR></script> yes | no | 1 | 0 | on | off specifies whether the dialog box displays the status bar. The default value for untrusted dialog boxes is yes . The default value for trusted dialogs is no . <script><BR> function topwin(){<BR> window.showModelessDialog("http://www.jb51.net","","dialogWidth:300px;dialogHeight:300px;scroll:no;status:no")<BR> }<BR></script>unadorned : yes | no | 1 | 0 | on | off specifies whether the dialog box displays chrome style borders. This parameter is only available when the dialog box is opened by a trusted program. The default value is no .
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn