JavaScript Basics (Update second wave)

Source: Internet
Author: User

Next, JavaScript opens a new window. The open () method can look for an existing or new browser window. Syntax: window.open ([URL]), [window name],[parameter string] parameter description: URL: Optional parameter, in the window to display the Web page 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", "_self" 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 with the same name can only create one, and the name cannot be the same if you want to create multiple windows. 4.name cannot contain spaces. Parameter string: Optional parameter, set window parameters, each parameter separated by commas. Parameter value description The top number window leaves the pixel at the top of the screen left number window left the left end of the screen number of pixels width number window height Number window menubar Yes,no window there is no menu Toolb AR yes,no window has no toolbar ScrollBars yes,no window There is no ScrollBar status Yes,no window there is no status bar for example: Open http://www.baidu.com website, size 300px*200px, no menu, No toolbar, no status bar, scroll bar window: <script type= "Text/javascript" >window.open (' http://www.baidu.com ', ' _blank ', ' width=300, Height=200,menubar=no,toolbar=no,status=no,scrollbars=yes ') Note: The running results consider browser compatibility issues. This point must pay attention to!!! And then say close window (window.close) Close () Close window usage: window.close ();//close this window or the < Window object >.close ();//close the specified window for example: Close the newly created window. <script type= "Text/javascript" > var mywin=window.open (' http://www.baidu.com ');//Opens the newly opened window object, stored in the variable MywinSpecies Mywin.close ();</script> Note: The above code opens a new window, closes the window, and does not see the window being opened. (Basically, there is no practical meaning to write this, but it doesn't really mean anything.) Like in Java, you want the black family money, the price sleep ... You know... This piece also depends on your practical use. Program apes also have to learn to be flexible. )

Leave a task:

1. Pop-up confirmation box when new window opens, open

Tip: 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.
You can combine the knowledge of the previous learning points to practice practiced hand. I'll post the code back.

JavaScript Basics (Update second wave)

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.