JavaScript Browser objects

Source: Internet
Author: User

Project just on-line several versions, finally can take a nap, idle to nothing, read a bit runoob, want to consolidate knowledge, and then found in JavaScript such a directory browser object. Suddenly found that they seem to use this piece of things often, but it seems that the understanding is not very comprehensive, no specific comprehensive read. So a special view and experiment.

Window object

This object has the following properties : (I have roughly divided the categories.) Just follow your own understanding of the simple classification. )
1. Document read-only reference to the Document object.

History's read-only reference to the History object.

Navigator a read-only reference to the Navigator object.

A read-only reference to the Screen object.

2. Location is used for window or frame location objects.

Self returns a reference to the current window. Equivalent to the Window property. Commonly used in window.top!=window.self to determine whether it is the top level

3. Name Sets or returns the window names. The name is commonly found in Mywindow=window.open (' ', ' Msgwindow ', ' width=200,height=100 '), which is the second parameter.

Closed returns whether the window has been closed.

The first time I looked at this, I had a full face. What's the use of this. Later looked at the demo, often used: var Mywindow=window.open ("", "", "width=400,height=200"), similar situation. You can control the newly opened page, which is often used with the Window.close (), window.open () method.

Parent returns to the parents window.

Top returns the topmost parent window.

Opener returns a reference to the window that created this window.

Frames returns all named frames in the window. (All iframe counts, whether or not SRC is counted.) Returned as an array. )

Length Sets or returns the number of frames in the window. (All of the IFRAME counts.) The number is consistent with the number of arrays in frames. PS: Theoretically, this is the case. If there's anything wrong with the welcome point. )

4. Innerheight returns the height of the document display area of the window, without the toolbar and scroll bar, the same as below.

Innerwidth returns the width of the document display area of the window.

Outerheight returns the outer height of the window, including the toolbar and scroll bar, below.

Outerwidth returns the outer width of the window.

Pagexoffset Sets or returns the X position of the current page relative to the upper-left corner of the window display area.

pageYOffset Sets or returns the Y position of the current page relative to the upper-left corner of the window display area.

Screenleft returns the x-coordinate relative to the screen window. (Firefox does not support this attribute, the same below)

Screentop returns the y-coordinate relative to the screen window.

ScreenX returns the x-coordinate relative to the screen window. (IE does not support this property, so when you want to use it, you can use it with the above method to achieve full browser compatibility.) Same below

ScreenY returns the y-coordinate relative to the screen window.

5. Defaultstatus Sets or returns the default text in the window's status bar. (Only opera is compatible.) No obvious significance. )

Status sets the text of the window's State bar. (Only opera is compatible.) No obvious significance. )

This object has the following methods : (Common can write directly is the method under window)

Alert () Displays a warning box with a message and a confirmation button.
Blur () Moves the keyboard focus away from the top-level window.
Clearinterval () cancels the timeout set by SetInterval ().
Cleartimeout () cancels the timeout set by the SetTimeout () method.
Close () Closes the browser window.
Confirm () Displays a dialog box with a message along with a confirmation button and a Cancel button.
Createpopup () Creates a pop-up window.
Focus () gives the keyboard focus to a window.
Moveby () Moves the specified pixel relative to the current coordinates of the window.
MoveTo () moves the upper-left corner of the window to a specified coordinate.
Open () Opens a new browser window or looks for a named window.
Print () Prints the contents of the current window.
Prompt () Displays a dialog box to prompt the user for input.
Resizeby () Resizes the window according to the specified pixel size.
Resizeto () Adjusts the size of the window to the specified width and height.
Scroll () (Window.scrollto is effectively the same as this method, which is consistent with ScrollTo)
Scrollby () Scrolls the content by the specified pixel value.
ScrollTo () Scrolls the content to the specified coordinates.
SetInterval () invokes a function or evaluates an expression by the specified period (in milliseconds).
SetTimeout () invokes a function or evaluates an expression after the specified number of milliseconds.

Not to be continued ~ ~

JavaScript Browser objects

Related Article

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.