window.open:
Window.Open is a non-resistive window, also known as a modeless window, that is, when you open window.open this child window, you can also switch to manipulate the parent window.
The general format is this:
- <Spanstyle="FONT-SIZE:14PX;"><Strong>window.open (' page.html ', ' newwindow ', 'height=100,width=400, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, < span class= "attribute" >resizable=no, location=no, status=no ') //the sentence as a line of code </strong> </span>
Where parameters:
window.open the command that pops up the new window;
The filename of the ' page.html ' pop-up window;
The name of the ' NewWindow ' pop-up window (not the file name), not required, available empty ' ' instead;
height=100 window height;
width=400 window width;
The pixel value of the Top=0 window from the top of the screen;
The pixel value of the left=0 window from the left side of the screen;
Toolbar=no whether the toolbar is displayed, yes is displayed;
MenuBar, which indicates the menu bar
ScrollBars indicates scroll bar, yes indicates page allows scrolling
Resizable=no whether the window size is allowed to change, yes is allowed;
Location=no whether the address bar is displayed, yes is allowed;
Status=no whether the information in the status bar is displayed (usually the file is already open), yes is allowed;
window.showModalDialog:
window.showModalDialog indicates a blocking window, that is, when the window is opened, the parent window is not allowed to be manipulated until it is closed
The general format is this:
- <strong>window.showmodaldialog ("modal.htm", "", "dialogwidth=200px; dialogheight=100px "); </Strong>
Some parameters:
Dialogheight: Height of dialog box, not less than 100px
Dialogwidth: The width of the dialog box.
Dialogleft: The distance from the left of the screen.
Dialogtop: Distance from the screen.
Center: {yes | no | 1 | 0}: Centered, default Yes, but can still specify height and width.
Help: {yes | no | 1 | 0}: Whether to display the Assist button, default yes.
Resizable: {yes | no | 1 | 0} [ie5+]: Whether the size can be changed. Default No.
Status: {yes | no | 1 | 0} [ie5+]: Whether the status bar is displayed. Default is yes[Modeless] or no[modal].
Scroll: {yes | no | 1 | 0 | on | off}: Scroll bar is displayed. The default is yes.
The following properties are used in an HTA and are generally not used in general Web pages.
dialoghide:{Yes | no | 1 | 0 | on | off}: Whether the dialog box is hidden when printing or printing preview. The default is No.
edge:{Sunken | raised}: Indicates the border style of the dialog box. The default is raised.
Unadorned: Default is No.
The general also to interact with the parent window, respectively, using Window.opener and window.dialogarguments, the specific use of the method can be on-line Baidu,
I'll add it when I get to know it.
(2017-3-17 18:37:27)
(add: For example, on a page using window.showModalDialog to open a page B and wear the value of the past, there can be a number of values including arrays, objects, etc., in the form of: (In JS on page a)
- var obj = new Object ();
- obj.name="51js";
- var jieshou = window.showmodaldialog ("modal.htm", obj, "dialogwidth=200px; dialogheight=100px ");
, and then receive it on the B page to write:
- var obj = window.dialogarguments
- Alert ("You passed the parameter:" + obj.name)
This means that you receive a page upload value, how Yang Yong is your business,
Then you want to close the page and then pass a value to the a page, on the B page this write:
- window.returnvalue="Hello";
Thus, the variable of Jieshou defined in the A-page JS is the value returned on the B-page, thus realizing the form of interaction between a seed window and a parent window! )
What about the interaction between the parent and child windows of window.open?
For example, the parent window's argument is this, the general to be in the form of a string to pass, specific can not be transmitted to other forms, I have not to delve into.
- function openTable (ID) {
- var feathers="Status=no,width=650px,height=670px,top=0px,menubar=no,resizable=no,scrollbars=yes,toolbar =no,channelmode=no ";
- var openwin = window.open ("allinfo.html?") +id+ "," +new Date (). GetTime (), "declare", feathers);
- Openwin.focus ();
- }
The child window then uses Window.location.search to receive the question mark (? ), and then split the string to get the value you want.
- <span style="FONT-SIZE:24PX;" ><script type="Text/javascript">
- var params= window.location.search;//params:?id,date
- var arr = params.substring (1). Split (",");
- var id = Arr[0];
- </Script> </span>
This allows the Id,window.opener to be used as a child window to manipulate the parent window directly, for example, when a child window is closed, call Window.opener.location.reload () to refresh, or, for example, Manipulate the data of the parent window directly on the child window page, such as: Window.opener.document.getElementById ("name"). Value = "input data"; To use JS to value or assign values.
Open new window, window.open and window.showModalDialog