Detailed description of New JavaScript window and sub-window value transfer

Source: Internet
Author: User

Window. open () support environment: JavaScript1.0 +/JScript1.0 +/Nav2 +/IE3 +/Opera3 +
Window. open (pageURL, name, parameters)
PageURL is the sub-window path
Name of the pop-up window
Parameters is window parameters (parameters are separated by commas)
AlwaysLowered | yes/no | specifies that the window is hidden behind all windows
AlwaysRaised | yes/no | specify that the window is suspended above all windows
Depended | yes/no | whether to close the parent window at the same time
Directories | yes/no | whether the directory bar of Nav2 and 3 is visible
Height | pixel value | window height
Hotkeys | yes/no | set the Security Exit hotkey in the window without menu bar
InnerHeight | pixel value | pixel height of the document in the window
InnerWidth | pixel value | pixel width of the document in the window
Location | yes/no | whether the location bar is visible
Menubar | yes/no | whether the menu bar is visible
OuterHeight | pixel value | set the pixel height of the window (including the decorative border)
OuterWidth | pixel value | set the pixel width of the window (including the decorative border)
Resizable | yes/no | whether the window size can be adjusted
ScreenX | pixel value | pixel length between the window and the left boundary of the screen
ScreenY | pixel value | pixel length between the window and the upper boundary of the screen
Scrollbars | yes/no | whether the window has a scroll bar
Titlebar | yes/no | whether the title bar of the window is visible
Toolbar | yes/no | whether the toolbar of the window is visible
Width | pixel value | pixel Width of the window
Z-look | yes/no | whether the window floated above other windows after being activated
Copy codeThe Code is as follows:
<Pre code_snippet_id = "182098" snippet_file_name = "blog_20140210_20176035784" name = "code" class = "javascript"> <SCRIPT>
Optional values open('page.html ', 'newwindow', 'height = 100, width = 400, top = 0, left = 0, toolbar = no, menubar = no, scrollbars = no, resizable = no, location = no, status = no ')
</SCRIPT> </pre>
<Pre> </pre>
<H2> <a name = "t3"> </a> <span style = "font-family: Microsoft YaHei; font-size: 14px "> <span style =" color: rgb (6,76, 76); line-height: 28px; text-indent: 32px "> <span style =" color: rgb (, 76); line-height: 28px; text-indent: 32px "> 2. </span> <span style = "font-family: 'hiragino Sans GB w3', 'hiragino Sans gb', Arial, Helvetica, simsun, u5b8bu4f53; font-size: 16px; text-indent: 32px; color: rgb (6,76, 76); line-height: 28px "> showModalDialog </span> <Pre> </pre>
<Pre> </pre>

VReturnValue = window. showModalDialog (sURL [, vArguments] [, sFeatures])
VReturnValue = window. showModelessDialog (sURL [, vArguments] [, sFeatures])
A required parameter for sURL. Type: string. Specifies the URL of the document to be displayed in the dialog box.
VArguments is an optional parameter; Type: variant. Used to pass parameters to the dialog box. The passed parameter types are not limited, including arrays. Dialog Box passed
SFeatures: an 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.
Window. dialogArguments to get the passed parameters.

1. dialogHeight: the dialog box height. The default unit of dialogHeight and dialogWidth in IE4 is em, while that in IE5 is px. For convenience, when defining the modal mode dialog box, unit with px.
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}: whether the window is centered. The default value is yes, but the height and width can still be specified.
6. help: {yes | no | 1 | 0}: whether to display the help button. The default value is yes.
7. resizable: {yes | no | 1 | 0} [IE5 +]: whether the size can be changed. No by default.
8. status: {yes | no | 1 | 0} [IE5 +]: whether to display the status bar. The default value is yes [Modeless] or no [Modal].
9. scroll: {yes | no | 1 | 0 | on | off}: Specifies whether the scroll bar is displayed in the dialog box. The default value is yes.
The following attributes are used in HTA and are not used in general web pages.
10. dialogHide: {yes | no | 1 | 0 | on | off}: whether the dialog box is hidden when printing or previewing. The default value is no.
11. edge: {sunken | raised}: Specify the border style of the dialog box. The default value is raised.
12. unadorned: {yes | no | 1 | 0 | on | off}: no by default.

// Parent.htm
Copy codeThe Code is as follows:
<Pre code_snippet_id = "182098" snippet_file_name = "blog_20140210_2_3894881" name = "code" class = "javascript"> <script>
Var obj = new Object ();
Obj. name = "51js ";
Window. showModalDialog ("modal.htm", obj, "dialogWidth = 200px; dialogHeight = 100px ");
</Script>
// Modal.htm
<Script>
Var obj = window. dialogArguments
Alert ("the parameter you passed is:" + obj. name)
</Script> </pre> <p> </p>
<Pre> </pre>
<P> </p>
<P> // --------------------------------- <br>
// 2. You can use window. returnValue to return information to the window that opens the dialog box. It can also be an object. Example: <br>
// -------------------------------- </P>
<P> </p> <pre code_snippet_id = "182098" snippet_file_name = "blog_20140210_3_47000096" name = "code" class = "javascript"> // parent.htm
<Script>
Str = window. showModalDialog ("modal.htm", "dialogWidth = 200px; dialogHeight = 100px ");
Alert (str );
</Script>
// Modal.htm
<Script>
Window. returnValue = "http://www.bokee.com ";
</Script> </pre> <br>
<Br>
<P> </p>
<P> 1. directly jump to the original form with <br>
Window. location. href = "the page you want to jump to"; <br>
2. Open the page in the new form: <br>
Window. open ('page to jump to '); </p>
<P> <span style = "color: # ff0000"> window. history. back (-1); return to the previous page </span> </p>
<P> <span style = "color: # ff0000"> <br>
</Span> </p>
<P> <span style = "color: # ff0000"> <br>
</Span> </p>

Related Article

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.