The open () method can look for an existing or new browser window.
Grammar:
window.open ([URL], [window name], [parameter string])
Parameter description:
URL: optional parameter, in the window to display the Web page's URL or path. If this argument is omitted, or if its value is an empty string, then the window will not display any documents. window name: optional parameter, the name of the window being opened. 1. The name consists of letters, numbers, and underscore characters. 2. " _top "," _blank "," _selft "have a special meaning name. _blank: Display the target page in a new window _self: Display the target page in the Current window _top: On the frames page, in the upper window, the target page 3. Windows of the same name can only be created one, and if you want to create multiple windows, name cannot be the same. 4.name cannot contain spaces. parameter string: optional parameter, set window parameters, each parameter separated by commas.
Parameter table:
For example: Open http://www.imooc.com website, size 300px * 200px, no menu, no toolbar, no status bar, scroll bar window:
<script type= "Text/javascript" > window.open (' http://www.imooc.com ', ' _blank ', ' width=300,height=200,menubar= No,toolbar=no, Status=no,scrollbars=yes ') </script>
Attention:
1. There are spaces between the comma and the equals sign between the parameters, the string is invalid and only the whitespace is removed to run correctly.
2. Run results consider browser compatibility issues.
=========================
Programming Exercises:
1. Pop-up confirmation box when new window opens, open
Use if to determine whether the confirmation box clicked OK, such as clicking the Popup Input dialog box, otherwise there is no action.
2, through the Input dialog box, determine the open URL, the default is http://www.imooc.com/
3, open the window requirements, 400 pixels wide, 500 pixels high, no menu bar, no toolbar.
Code:
javascript--Opening a new window (window.open)