JavaScript Window object property Collation _ Basics

Source: Internet
Author: User
Tags setinterval time interval
The Window object has the following methods:
Open
Close
Alert
Confirm
Prompt
SetTimeout
Cleartimeout
SetInterval
Clearinterval
Moveby
MoveTo
Resizeby
Resizeto
Scrollby
Scrollto
Find
Back
Forward
Home
Stop
Print
Blur
Focus
Captureevent
Enableexternalcapture
Disableexternalcapture
Handleevent
Releaseevent
Routeevent
Scroll
1. Open method
Syntax format:
window.open (URL, window name, window style)
Function: Opens a new window and loads the page with the specified URL address in the window.
Description
The Open method opens a new browser window and loads a specified URL address in a new window;
The Open method can also specify the name of the window (the second argument) when it opens a new browser window;
The Open method can also specify the style of the window (the third argument) when you open a new browser window.
The window style has the following options, which can be selected more than one option, separated by commas if multiple selections:
Toolbar: Specifies whether the window has a standard toolbar. When the value of this option is 1 or yes, it indicates a standard
toolbar, when the value of this option is 0 or no, indicates that there is no standard toolbar;
Location: Specifies whether the window has an address toolbar, and the value and meaning of the option are the same as toolbar;
Directories: Specifies whether the window has a link toolbar, and the value and meaning of the option is the same as toolbar;
Status: Specifies whether the window has a status bar, and the value and meaning of the option are the same as toolbar;
MenuBar: Specifies whether the window has a menu, the value of the option and the meaning is the same as toolbar;
ScrollBar: Specifies whether scroll bars are available when the current window document is larger than the window, and the value of the option and
toolbar the same;
Resizable: Specifies whether the window can be resized, and the value and meaning of the option is the same as toolbar;
Width: in pixels, the window is specified to be innerwidth replaced;
Height: Specifies the height of the window in pixels, which has been replaced by Innerheight;
Outerwidth: Specifies the external width of the window in pixels;
Outerheight: Specifies the outer height of the window in pixels;
Left: Specifies, in pixels, the position of the window from the left-hand side of the screen;
Top: Specifies, in pixels, the position of the window from the tip of the screen;
Alwayslowered: Specifies that the window is hidden behind all windows, and that the value and meaning of the option are the same as toolbar;
Alwaysraised: Specifies that the window floats above all windows, and that the value and meaning of the option are the same as toolbar;
Dependent: Specifies that the open window is a child of the current window and is closed with the parent window
Off, the value and meaning of the option are the same as toolbar;
Hotkeys: Set a safe exit hotkey in a new window without a menu bar, the value of the option and the meaning of the
toolbar the same;
Innerheight: Set the pixel height of the Chinese file in the window;
Innerwidth: Set the pixel width of the Chinese file in the window;
ScreenX: Sets the pixel length of the window from the left edge of the screen;
ScreenY: Sets the pixel length of the window from the boundary of the screen;
TitleBar: Indicates whether the title bar is visible in a new window, and the value and meaning of the option is the same as toolbar;
Z-look: Indicates that when the window is activated, it cannot float on top of other windows, the value of the option and the meaning of the
Toolbar the same.
The Open method returns a reference to the window.
Tip: This method is often used to open another window automatically when you open a Web page.
Example 6-2-1: A small program that automatically opens another window when the current window is opened, requiring that the window has no standard toolbars, address bars, link toolbars, menu bars, but a status bar, and the window plays
The opening page address is: http://www.jb51.net.
2. Close method
Syntax format:
Window.close ()
Function: The Close method closes the browser window automatically.
3. Alert method
Syntax format:
Window.alert (Hint string)
Function: A warning box pops up, and a hint string text appears in the Warning box.
4. Confirm method
Syntax format:
WINDOW.CONFIRM (Hint string)
Function: Displays a confirmation box, displays the prompt string in the confirmation box, and when the user clicks the OK button
The method returns true and False when you click Cancel.
5. Prompt method
Syntax format:
WINDOW.PROMPT (hint string, default text)
Features: Displays an input box, displays the prompt string in the input box, and displays the default text in the Input text box
This, and waits for user input, when the user clicks the "OK" button, returns the user input string, when
Returns a null value when you click the Cancel button.
6. SetTimeout method
Syntax format:
Window.settimeout (Code character expression, number of milliseconds)
Function: Timed setting, automatically executes the code character expression after the specified number of milliseconds.
7. Cleartimeout Method
Syntax format:
Window.cleartimeout (timer)
Function: Cancels the previous timer setting, where the parameter is the return value when set with SetTimeout.
8. SetInterval method
Syntax format:
Window.setinterval (Code character expression, number of milliseconds)
Function: After setting a time interval (the second parameter), repeatedly executes the contents of the "Code character expression"
9. Clearinterval method
Syntax format:
Window.clearinterval (Time spacer)
Function: Cancels the timing of the setinterval setting. The parameter is the return value of the SetInterval method.
Moveby method
Syntax format:
Window.moveby (horizontal displacement, vertical displacement)
Function: Moves the specified window according to the given pixel parameters. The first argument is the pixel at which the window moves horizontally,
Two parameters are pixels that the window moves vertically.
11.moveTo method
Syntax format:
Window.moveto (X,y)
Function: Moves the window to the specified coordinates (X,Y).
Resizeby method
Syntax format:
Window.resizeby (horizontal, vertical)
Function: Changes the current window to the specified size (x,y) and expands when the value of x and Y is greater than 0, less than 0 o'clock
To shrink.
Resizeto method
Syntax format:
Window.resizeto (horizontal width, vertical width)
Function: Change the current window to (x,y) size, x, y is width and height respectively.
Scrollby method
Syntax format:
Window.scrollby (horizontal displacement, vertical displacement)
Function: Scrolls the contents of a window by a given amount of displacement. When the argument is positive, it scrolls forward, otherwise the inverse
To scroll.
Scrollto method
Syntax format:
Window.scrollto (X,y)
Function: Scrolls the contents of a window to a specified location.
16.find method
Syntax format:
Window.find ()
Function: When this method is triggered, a Find dialog window pops up and allows the user to touch
Find a string in the page where you send the search method.
Note: This property is not supported in both IE5.5 and Netscape6.0.
Back method
Syntax format:
Window.back ()
Function: Simulate the user clicks the "Back" button on the browser and turn the page to the previous page of the browser.
Description: This action can only be performed if the current page has a previous page.
Note: IE5.5 does not support this method, Netscape6.0 support.
Forward method
Syntax format:
Window.forward ()
Function: Simulate the user clicks on the "Forward" button on the browser, the page will be transferred to the next page of the browser.
Description: This action can only be performed if the current page exists on the next page.
Note: IE5.5 does not support this method, Netscape6.0 support.
Home method
Syntax format:
Window.home ()
Function: Simulate the user clicks on the browser "Home" button, the page will be transferred to the specified page.
Note: IE5.5 does not support this method, Netscape6.0 support.
Stop method
Syntax format:
Window.stop ()
Function: Simulate the user clicks the "Stop" button on the browser, terminate the download operation of the browser.
Note: IE5.5 does not support this method, Netscape6.0 support.
Print method
Syntax format:
Window.print ()
Function: Simulate the user clicks the "Print" button on the browser, informs the browser to open the Print dialog box to print
The current page.
Blur Method
Syntax format:
Window.blur ()
Function: Removes the focus from the window. Be careful when sharing with the focus method, because it can cause focused
Constantly move in and out.
Focus Method
Syntax format:
Window.focus ()
Function: Gets the focus in the window. Be careful when sharing with the Blur method because it may cause the focus to not
Break move in Move out
Captureevent method
Syntax format:
Window.captureevent (Event)
Window.captureevent (Event 1| Event 2|...| Event N)
Function: Captures all events for the specified parameter. Because you can capture which events are handled by the local program itself
, so programmers can arbitrarily define functions to handle events. If there are multiple events that need to be captured, the events
With the pipe character "|" Separated. The types of events that can be captured are as follows:
Event.abort
Event.blur
Event.change
Event.click
Event.dblclick
Event.dragdrop
Event.error
Event.focus
Event.keydown
Event.keypress
Event.keyup
Event.load
Event.mousedown
Event.mousuemove
Event.mouseout
Event.mouseover
Event.mouseup
Event.move
Event.reset
Event.resize
Event.select
Event.submit
Event.unload
Enableexternalcapture incident
Syntax format:
Window.enableexternalcapture (Event)
Function: The Enableexternalcapture method is used to catch external events passed in by parameters.
Disableexternalcapture incident
Syntax format:
Window.disableexternalcapture ()
Function: Cancels the setting of the Enableexternalcapture method and terminates the capture of external events.
Handleevent incident
Syntax format:
Window.handleevent (Event)
function: Triggers the event handler for the specified event.
Releaseevent incident
Syntax format:
Window.releaseevent (Event)
Window.releaseevent (Event 1| Event 2|...| Event N)
Function: Releases the captured events passed through the parameter, which are
The Window.captureevent method is set, and the event that can be released is the same as captureevent.
Routeevent incident
Syntax format:
Window.releaseevent (Event)
Function: Transfer all events of a captured type to a standard event-handling method for processing, which can be forwarded
Pieces are the same as captureevent.
Scroll Event
Syntax format:
Window.Scroll (x coordinates, y coordinates)
Function: Moves the window to the specified coordinate position.
Properties of the 6-2-2 window object
The Window object has the following properties:
Status
StatusBar
Statusbar.visible
Defaultstatus
Location
Locationbar
Locationbar.visible
Self
Name
Closed
Frames
Frames.length
Length
Document
History
Innerheight
Innerwidth
MenuBar
Menubar.visible
Opener
Outerheight
Outerwidth
Pagexoffset
pageYOffset
Parent
Personalbar
Personalbar.visible
ScrollBar
Scrollbar.visible
Toolbar
Toolbar.visible
Top
1. Status Property
Syntax format:
window.status= string
Function: Sets or gives the current display information for the status bar in the browser window.
Tip: You can use this property to set the browser window status bar information.
2. StatusBar Properties
Syntax format:
Window.statusbar. Properties
Function: The StatusBar property itself is also an object that accesses its own visible property to
The fixed status bar is visible.
Note: The ie5.5 browser does not support this property.
3. Statusbar.visible Properties
Syntax format:
Window.statusbar.visible
Function: Checks whether the status bar is visible, returns True if it is visible, and returns false.
Note: The ie5.5 browser does not support this property.
4. Defaultstatus Properties
Syntax format:
window.defaultstatus[= string]
Function: Defaultstatus property value is the default display information for the status bar in the browser window
5.location Properties
Syntax format:
Window.location=url
Function: gives the URL information for the current window or specifies the URL of the open window.
6. Locationbar Properties
Syntax format:
Window.locationbar. Properties
Function: The Locationbar property can also be viewed as a child object, which is used to obtain its own
Visible property to determine whether the position bar is visible.
So far, this property has only one child property: visible.
Note: This property is not supported by ie5.5.
7. Locationbar.visible Properties
Syntax format:
Window.locationbar.visible
Function: Returns whether the position bar is visible, returns true if visible, and returns false.
Note: This property is not supported by ie5.5.
8. Self attribute
Syntax format:
Window.self. Method
Window.self. Properties
Function: This property contains the flag of the current window, which can be used to ensure that multiple windows are opened
, the function or property within the current window is called correctly without confusion.
9. Name property
Syntax format:
Window.name= Name
Function: Returns the name of the window given when a new window is created by the window.open () method.
In the javascript1.0 version, this property can only be used to read the window name, and the
javascript1.1 version, you can use this property to give an attribute that is not created with the window.open () method.
window to specify a name.
Closed properties
Syntax format:
Window.closed
Function: The closed property is used to return whether an instance of the specified window is closed, and returns True if it is closed
, and return to Flase instead.
Frames Properties
Syntax format:
window.frames["frame name"]
window.frames[value]
Function: The Frames property is an array that stores every child window created by the element in the document (box
instance, where the subscript can be a secondary ordinal number or a name specified with the Name property of the FRAME element
Called to get and use.
Frames.length Properties
Syntax format:
Window.frames.length
Function: The Frames.length property is used to give the number of instances of a document's neutron window (frame).
Length Property
Syntax format:
Window.length
Function: The Length property returns the number of child windows within a window that is associated with the
The value of the Window.frame.length property is the same.
Document properties
Syntax format:
Window.document. Events
Window.document. Method
Window.document. Properties
Features: The child object document of the Window object is the core object of JavaScript, encountered in the script
Creates an instance when the BODY element is created.
History properties
Syntax format:
window.history[value]
Window.history. Method ()
Window.history. Properties
The child object of the Window object history is one of the core objects of JavaScript, which contains a
An array of the names and URLs of the pages that have been visited.
Innerheight Properties
Syntax format:
window.innerheight= value
Function: Returns or specifies the pixel height of the document in the browser window, which does not include any toolbars and
The page-decoration height that makes up the window.
Note: This property is not supported by ie5.5.
Innerwidth Property
Syntax format:
window.innerheight= value
Function: Returns or specifies the pixel width of the document in the browser window, which does not include any toolbars and
The page decoration width that makes up the window.
Note: This property is not supported by ie5.5.
MenuBar Properties
Syntax format:
Window.menubar. Properties
Function: The MenuBar property can also be viewed as a child object, which is used to obtain its own
Visible property to determine whether the menu bar is visible.
So far, this property has only one child property: visible.
Note: This property is not supported by ie5.5.
Menubar.visible Properties
Syntax format:
Window.menubar.visible
Function: The Menubar.visible property is used to return whether the menu bar is visible, and if the visible returns true, the inverse
returns FALSE.
Note: This property is not supported by ie5.5.
Opener Properties
Syntax format:
Window.opener
Window.opener. Method
Window.opener. Properties
Function: The opener property is associated with the parent window that opens the window, and when you access the Operer property in the child window
, the parent window is returned. This property enables you to use methods and properties in the parent window object.
Outerheight Property
Syntax format:
Window.outerheight
Function: The Outerheight property is used to access the pixel height of the browser window, which includes the toolbar and
The height of the trim edge.
Note: This property is not supported by ie5.5.
Outerwidth Properties
Syntax format:
Window.outerwidth
Function: The Outerwidth property is used to access the pixel width of the browser window, which includes the toolbar and the loaded
The width of the trim edge.
Note: This property is not supported by ie5.5.
Pagexoffset Properties
Syntax format:
window.pagexoffset= value
Function: Specifies the current horizontal pixel position in the window in the upper-left corner of the browser window's Chinese file. In using
You can use this property to determine whether you need to move a window before moveto move. Because the property returns the
The current position of the visible document relative to the entire page.
Note: This property is not supported by ie5.5.
pageYOffset Properties
Syntax format:
window.pageyoffset= value
Function: Specifies the current vertical pixel position in the window in the upper-left corner of the browser window's Chinese file. In using
You can use this property to determine whether you need to move a window before moveto move. Because the property returns the
The current position of the visible document relative to the entire page.
Note: This property is not supported by ie5.5.
Parent Property
Syntax format:
window.parent.frames[value]
Window.parent.framesname
Features: Accesses the parent window of each child window (multiple frames).
Personalbar Property
Syntax format:
Window.personalbar. Properties
Function: The Personalbar property itself is also an object that accesses its own visible property to confirm
Make sure the personal column is visible.
Note: This property is not supported by ie5.5.
Personalbar.visible Property
Syntax format:
Window.personalbar.visible
Function: Determines whether the personal bar is visible, returns True if it is visible, and returns false.
Note: This property is not supported by ie5.5.
ScrollBars Properties
Syntax format:
Window.scrollbars. Properties
Function: The ScrollBars property itself is also an object that accesses its own visible property to confirm
Whether the fixed scroll bar is visible
Note: This property is not supported by ie5.5.
Scrollbars.visible Properties
Syntax format:
Window.scrollbars.visible
Function: Scrollbars.visible is used to determine whether the scroll bar is visible and returns true if it is visible, anti
returns FALSE.
Note: This property is not supported by ie5.5.
Toolbar properties
Syntax format:
Window.toolbar. Properties
Function: The toolbar property itself is also an object that accesses its own visible property to determine
Whether the toolbar is visible.
Note: This property is not supported by ie5.5.
Toolbar.visible Property
Syntax format:
Window.toolbar.visible
Function: The Toolbar.visible property is used to check whether the toolbar is visible and returns true if it is visible.
return false instead.
Note: This property is not supported by ie5.5.
Top Properties
Syntax format:
window.top.frames[value]
Window.top.framename
Window.top. Method ()
Window.top. Properties
Function: The top property of the Window object is used to contain information about the topmost window of all mounted browser's child windows (multiple frames).

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.