Pop-up window commands detailed

Source: Internet
Author: User
Tags return trim window access
A variety of pop-up windows command details, very detailed, will be helpful to you. 1, window.open (pageurl,name,parameters)
Pageurl is the pop-up window path;
Name for pop-up window, can also be the system itself, such as: _self, _blank,_top,_parent ...;
Parameters is the window parameter (separated by commas);
Various parameters
Where yes/no can also use 1/0,pixel value as the specific value, the unit pixel.
Parameter value range description
Alwayslowered yes/no Specifies that the window is hidden behind all windows
Alwaysraised yes/no Specifies that the window is suspended above all windows
Depended yes/no is closed with the parent window at the same time
Directories yes/no Nav2 and 3 are visible in the directory bar
Height pixel value Window heights
Hotkeys yes/no a safe exit hotkey in a window without a menu bar
Innerheight pixel Value window Chinese file pixel height
Innerwidth pixel Value window Chinese file pixel width
Location yes/no whether the position bar is visible
MenuBar yes/no whether the menu bar is visible
Outerheight The pixel height of the Pixel Value setting window (including the trim border)
Outerwidth pixel value set the pixel width of the window (including the trim border)
Resizable yes/no window size can be adjusted
ScreenX pixel value window pixel length from left edge of screen
ScreenY pixel value window pixel length from the edge of the screen
ScrollBars yes/no window can have scroll bars
TitleBar yes/no Window topic bar is visible
Toolbar whether the Yes/no window toolbar is visible
Width pixel value window pixel widths
Z-look whether the yes/no window floats on top of other windows when it is activated
Common examples:
window.open (' page.html ', ' newwindow ', ' fullscreen '); Fullscreen
window.open (' page.html ', ' _self ', ' fullscreen = yes, height=100, width=400, Top=0, left=0, Toolbar=no, Menubar=no, Scrol Lbars=no,resizable=no,location=no, Status=no '); A full-screen window pops up on the current page and has detailed settings
Popwin = window.open (' test.jsp '); Gets the pop-up object for operation
Popwin. focus (); Focus window

2, Window.alert () parameter, only one, display the warning box information, no return value.

3, Window.confirm () parameter is only one. Displays information about the prompt box. Press OK, return True, and return false by canceling.

4, Window.prompt () parameters, there are two, the first parameter, display prompts the input box information. The second parameter, which displays the default value for the input box. Returns the value entered by the user.

5. The window.showModalDialog () method is used to create a modal dialog box that displays HTML content. The Window.showmodelessdialog () method is used to create a modeless dialog box that displays HTML content.

The difference between ShowModalDialog () and showModelessDialog () is that the ShowModalDialog () open window, placed on the parent window, must be closed to access the parent window; showModelessDialog (), You do not have to close or access the window opened by the parent window.

How to use:
Vreturnvalue = window.showModalDialog (sURL [, varguments] [, sfeatures]);
Vreturnvalue = Window.showmodelessdialog (sURL [, varguments] [, sfeatures]);
Parameter description:
surl--
Required parameter, type: String. The URL used to specify the document to display in the dialog box.
varguments--
Optional parameter, type: Variant. Used to pass parameters to the dialog box. The parameter types passed are not limited, including arrays, and so on. The dialog box is window.dialogarguments to get the parameters passed in.
sfeatures--
Optional parameter, type: String. Used to describe information such as the appearance of a dialog box, you can use one or more of the following, separated by semicolons.
1.dialogHeight: Dialog height, not less than 100px,ie4 dialogheight and dialogwidth default unit is EM, and IE5 is PX, in order to facilitate its see, in the Definition of modal dialog box, with PX to do units.
2.dialogWidth: Dialog box width.
3.dialogLeft: The distance from the left of the screen.
4.dialogTop: The distance from the screen.
5.center: {Yes No 1 0}: The window is centered, the default yes, but the height and width can still be specified.
6.help: {Yes No 1 0}: Show Help button, default yes.
7.resizable: {Yes No 1 0} [ie5+]: can be changed size. Default No.
8.status: {Yes No 1 0} [ie5+]: Whether the status bar is displayed. Default is yes[Modeless] or no[modal].
9.scroll:{Yes No 1 0 on off}: Indicates whether the dialog box displays scroll bars. The default is yes.

Parameter passing:
To pass arguments to the dialog box, it is passed through the varguments. Type is not restricted, for a string type, the maximum is 4,096 characters. You can also pass objects, for example:
Call page
<script>
var obj = new Object ();
Obj.name= "Lovejs";
window.showModalDialog ("modal.htm", obj, "dialogwidth=200px;dialogheight=100px");
</script>
dialog Box page
<script>
var obj = window.dialogarguments;
Alert ("The parameter you passed is:" + obj.name)
</script>

Get object:
You can return information by Window.returnvalue to the window that opens the dialog box, or you can also be an object. For example:
Call page
<script>
str = window.showmodaldialog ("modal.htm", "dialogwidth=200px;dialogheight=100px");
alert (str);
</script>
dialog Box page
<script>
Window.returnvalue= "Do what you want here";
</script>

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.