In the system, javascript open window is used in some places. For example, you can open a window in fixed mode to prevent other operations.
Parameters:
Copy codeThe Code is as follows:
Parameter | value range | description
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
Instance:
Copy codeThe Code is as follows: window. open ("page.html", "newwindow", "height = 100, width = 100, top = 0, left = 0, toolbar = no, menubar = no, scrollbars = no, resizable = no, location = no, status = no ")
Calculate the height and width based on the resolution and enable it:
Copy codeThe Code is as follows: var ht = screen. height-98;
Var widhh = screen. width-20;
Window. opener = null;
Window. open ("", "_ self ");
Window. open ("Main. aspx", "newwindow" + JsGuid (),
"Height =" + ht + ", width =" + widhh + ",
Depended = yes, top = 0, left = 0, toolbar = no, menubar = no,
Scrollbars = yes, resizable = no, location = no, status = yes ");
Window. close ();
And close the original window.
Problem:
After window. open, if the system exits, an error occurs when window. open is used again to open a new page.
Google hasn't been found for a long time. This problem may not happen frequently. It must be a configuration problem.
The second parameter of window. open is the name of the new window. This name cannot be repeated.
If it already exists, refresh it in this window.
So I added a random GUID function for js.
Copy codeThe Code is as follows: function s4 (){
Return Math. floor (1 + Math. random () * 0x10000)
. ToString (16)
. Substring (1 );
};
Function JsGuid (){
Return s4 () + s4 () + '-' + s4 () + '-' + s4 () + '-' +
S4 () + '-' + s4 () + s4 () + s4 ();
}
When opening a window, use: window. open ("Main. aspx", "newwindow" + JsGuid ());
OK. Solve the problem.