Window Object window (javascript) Function

Source: Internet
Author: User
1. The window object corresponds to the <Body> and <FrameSet> identifiers in the HTML document;
You can directly reference window objects in javascript scripts. For example, window. alert ("window object Input Method ")
The following format can be used: alert ("window object Input Method"). The default format is the window object method.

2. Window objects mainly include the onload event for loading Web document events and the onunload Event for unloading.

3. Window object Method
The window. open (parameter table) method creates a new window. The parameter table provides the main features of windows and the names of documents and windows.
Window. open ("URL", "Window name", "Window attribute"]
The window property parameter is a string list item separated by commas (,). It specifies the properties of the newly created window. See the following table.

Parameter Value

Toolbar yes/no create or do not create Standard toolbar
Location yes/no create or do not create a location input field
Directions yes/no create or do not create a standard directory button
Status yes/no
Menubar yes/no create or do not create a menu bar
Scrollbar yes/no create or do not create a scroll bar
Revisable yes/no can change the window size
Width yes/no determine the window width
Height yes/no determines the window Height.

Note the following when using the Open () method:
1. A document is always opened in a browser window. Therefore, you do not need to create a new document for the output.
2. After writing a Web document, use or call the close () method to close the output stream.
3. when you use open () to open a new stream, you can specify a valid document type for the document, valid document types include text/HTML, text/gif, text/xim, and text/plugin.

The alert () method can create a dialog box with the OK button.
The confirm () method provides a dialog box with two buttons for the programmer.
The prompt () method allows you to enter information in the dialog box and use the default value. The basic format is prompt ("prompt information", default value ).

4. properties in window objects
1. Number of frames in the frames document
Frames (frame) can be used to separate windows. Note the following when using it:
The frames attribute is referenced in the sequence of HTML identifiers <Frames>. It contains all frames in a window.
The frame itself is a type of window that inherits all the attributes and methods of the window object.
2. Parent indicates the Parent window of the current window or frame.
3. defaultstatus: default status. Its value is displayed in the status bar of the window.
4. status: contains the current information in the frame in the document window.
5. top: includes the window used to implement all lower-level windows.
6. window refers to the current window.
7. self: reference the current window.

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.