js window object properties and methods

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: window.open (URL, window name, window styles)

Function: Open a new window and loads the web page URL address specified in the window.

Description:

open method for opening a new browser window, and loaded into a URL address specified in a new window;

When open method opens a new browser window, you can specify the name (the second parameter) of the window;

open method When you open a new browser window, you can also style (the third argument) of the specified window, the window style has the following options that can be selected, if multiple choice, among the items separated by commas:

toolbar: Specifies whether the window has a standard toolbar. When the value of 1 or yes for this option, it indicates that the standard toolbar, when the value is 0 or no option, that there is no standard toolbar;

location: Specifies whether the window has the address toolbar, the same value and meaning toolbar options;
Directories: Specifies whether the window has the Links toolbar, the same value and meaning toolbar options;
Status: Specifies whether the window has a status bar, the value of the option and the same meaning toolbar;
MenuBar: Specifies whether the window has a menu, the same value and meaning toolbar options;
scrollBar: specify whether the current scroll bar when the window is a document larger than the window, the same value and meaning toolbar options;
resizable: specified window whether to change the size, value and the same meaning toolbar option;
width: pixels specified width of the window, has been replaced by the innerWidth;
height: pixels specified window height, has been substituted innerHeight,;
the outerWidth: pixels the outer width of the specified window units;
outerHeight: external height in pixels of the specified window;
left: pixels specified window from the left position of the screen;
top: pixels specified window from the screen to the top position;
alwaysLowered: hidden in the specified window After the window, the value and meaning of the toolbar options the same;
alwaysRaised: specified window float above all windows, the same value and meaning toolbar options;
dependent: Specifies the open window as a child window of the current window, and as a parent Close the window closed, the value and meaning of the toolbar options the same;
hotkeys: set the security exit hotkey in new window no menu bar, the value and meaning of the toolbar options the same;
innerHeight: set of pixels in the document window height;
innerWidth: set the pixel width of the window in the document;
screenX: set the length of the window of pixels from the left edge of the screen;
screenY: pixel length of the boundary of the setting window from the screen;
the titleBar: indicates the title bar is visible in a new window, Options and the value of the same meaning toolbar;
Z-look: when indicates when the window is active, not float on top of other windows, and the values of the toolbar option same meaning.
method returns a reference to open the window.

Tip: This method is often used to automatically open another window when you open a Web page.

2. close method

Syntax: window.close ()

Function: close method for automatically closing the browser window.

3. alert method

Syntax: window.alert (prompt string)

Function: pop up a warning box to display the prompt string of text in the warning box.

4. confirm Method

Syntax: window.confirm (prompt string)

Function: A confirmation box appears, displaying the confirmation prompt string box, returned when the user clicks the "OK" button which true, returns false when you click "Cancel."

5. prompt Method

Syntax: window.prompt (prompt string, default text)

Function: Displays an input box to display the prompt string in the input box, the default text in the text box and wait for user input when the user clicks the "OK" button to return to the string entered by the user, when click when the "cancel" button, to return a null value.

6. setTimeout method

Syntax: window.setTimeout (code character expression, milliseconds)

Function: timing settings, when a specified number of milliseconds to be executed automatically after the code character expression.

7. clearTimeout method

Syntax: window.clearTimeout (timer)

Function: cancels the previous setting timer, wherein the parameters are set with the value returned setTimeout.

8. setInterval Method

Syntax: window.setInterval (code character expression, milliseconds)

Function: After setting a time (the second parameter) intervals, the contents of repeatedly executed "code character expression" in

9. clearInterval Method

Syntax: window.clearInterval (spacer time)

Functions: setInterval cancel the timer settings. Wherein the parameter is the return value of setInterval method.

10. moveBy Method

Syntax: window.moveBy (horizontal displacement and vertical displacement amount)

Function: Moves the specified window according to a given pixel parameter. The first parameter is the window horizontally moving pixels, the second parameter is the vertical pixel window moves.

11.moveTo method

Syntax: window.moveTo (x, y)

Function: move the window to a specified designated coordinates (x, y) at.

12. resizeBy Method

Syntax: window.resizeBy (horizontal, vertical)

Function: change the current window size specified (x, y), when the value of x, y is greater than 0 to expand, it is less than 0 is reduced.

13. resizeTo方法

Syntax: window.resizeTo (horizontal width and vertical width)

Function: to change the current window (x, y) size, x, y are the width and height.

14. scrollBy Method

Syntax: window.scrollBy (horizontal displacement and vertical displacement amount)

Function: The contents of the window by a given amount of displacement of the scrolling. When the argument is positive, rolling forward, otherwise reverse scrolling.

15. scrollTo Method

Syntax: window.scrollTo (x, y)

Function: The contents of the window to scroll to the specified location.

16.find method

Syntax: window.find ()

Function: When the method is triggered, will pop up a "find" (Find) dialog window, and allows users to search for a string in the find page trigger method.

Note: This attribute is not supported in IE5.5 and Netscape6.0 in.

17. back method

Syntax: window.back ()

Function: Analog user clicks the "back" button on your browser, the page to your browser's back.

Description: Only when the current page exists Previous to this operation.

Note: IE5.5 does not support this method, Netscape6.0 support.

18. forward method

Syntax: window.forward ()

Function: Analog user clicks the "forward" button on your browser, the browser will go to the next page.

Description: Only when there is a next current page to perform the operation.

Note: IE5.5 does not support this method, Netscape6.0 support.

19. home method

Syntax: window.home ()

Function: Analog user clicks on the "Home" button on your browser, go to the page on the specified page.

Note: IE5.5 does not support this method, Netscape6.0 support.

20. stop Method

Syntax: window.stop ()

Function: Analog user clicks the "Stop" button on the browser, browser download operation is terminated.

Note: IE5.5 does not support this method, Netscape6.0 support.

21. print method

Syntax: window.print ()

Function: Analog user clicks the "print" button on your browser to notify the browser to open the Print dialog box to print the current page.

22. blur method

Syntax: window.blur ()

Function: the focus is removed from the window. When combined with the focus method must be careful, because it may lead to focus constantly moving in and out.

23. focus method

Syntax: window.focus ()

Function: the window to focus obtained. When combined with the method must be carefully blur, because it may lead to focus continuously moved into and out

24. captureevent Method

Syntax: window.captureevent (event)

window.captureevent (Event 1 | Event 2 | ... | events n)

Function: All events are captured specified parameters. Because what events by the local program can capture their own process, so the programmer can define a function to handle the event. If there are multiple events need to capture, use the pipe symbol between each event "|" separated. Type of event can be captured 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

25. enableexternalcapture事件

Syntax: window.enableexternalcapture (event)

Function: enableexternalcapture method for capturing the parameters passed to external events.

26. disableexternalcapture事件

Syntax: window.disableexternalcapture ()

Function: unset enableexternalcapture method of terminating capture to external events.

27. handleevent event

Syntax: window.handleevent (event)

Function: Trigger event handler for the specified event.

28. releaseevent event

Syntax: window.releaseevent (event)

window.releaseevent (Event 1 | Event 2 | ... | events n)

Function: release by argument to have been captured events, which are set by the window.captureevent methods, releasable events captureevent same.

29. routeevent event

Syntax: window.releaseevent (event)

Function: All type of event is captured transferred to the standard event handling methods of treatment, care and captureevent same event.

30. scroll event

Syntax: window.scroll (x coordinate, y coordinate)

Function: move the window to the specified coordinate position.

Property of the window object

window object has the following attributes:

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 attribute

Syntax: window.status = String

Function: Set or give the browser window status bar displays current information.

Tip: You can use this property to set browser window status bar.

2. statusbar property

Syntax:. Window.statusbar property

Function: statusbar property itself is a target for accessing its own visible attribute to determine the status bar is visible.

Note: ie5.5 browser does not support this property.

3. statusbar.visible property

Syntax: window.statusbar.visible

Features: Check the status bar is visible, if visible returns true, otherwise returns false.

Note: ie5.5 browser does not support this property.

4. defaultstatus Properties

Syntax: window.defaultstatus [= String]

Function: defaultstatus property value is the default browser window status bar displays information

5.location property

Syntax: window.location = url

Function: url gives information about the current window or open the window specified url.

6. locationbar property

Syntax:. Window.locationbar property

Function: locationbar property can also be seen as a sub-object, this attribute is used to obtain its own visible property to determine the location bar is visible. So far, the property is only a sub-attributes: visible.

Note: ie5.5 does not support this property.

7. locationbar.visible property

Syntax: window.locationbar.visible

Function: Returns the location bar is visible, if visible returns true, and vice versa returns false.

Note: ie5.5 does not support this property.

8. self Properties

Syntax:. Window.self method

window.self. property

Function: This attribute contains the current flag of the window, use this property, you can ensure that in the case of multiple windows are open, the correct call functions or attributes within the current window without confusion.

9. name attribute

Syntax: window.name = name

Function: Returns the window name, which is when you create a new window by the window.open () method given. In javascript1.0 version, this property can only be used to read the name of the window, and when to javascript1.1 version, you can use this property to a not use window.open () method creates a window to specify a name.

10. closed Properties

Syntax: window.closed

Function: closed window attribute whether to return the specified instance has been closed, if closed, returns true, and vice versa to return flase.

11. frames property

Syntax: window.frames [ "frame name"]

window.frames [value]

Function: frames property is an array to store the document instance (frame) for each child window is created by the element, i.e., wherein the index may be a sequence number may be specified by the name of the name attribute of the frame element is obtained and use.

12. frames.length Properties

Syntax: window.frames.length

Function: frames.length attribute gives the number of instance of the document neutron window (frame).

13. length Properties

Syntax: window.length

Function: length property returns the number of child window within a window, the value of the attribute with the same attribute window.frame.length.

14. document properties

Syntax: window.document event window.document method window.document property...

Function: sub-object document window object is the core javascript object, create an instance of the face of the body element in the script.

15. history property

Syntax:. Window.history [value] The method of the window.history () the window.history properties.

Child object history window object is one of the core javascript object, the property contains an array name has been accessed and url of the page.

16. innerheight property

Syntax: window.innerheight = value

Function: Returns the height in pixels or specify the document in the browser window, the height of the page does not include any toolbars and window consisting of modified highly.

Note: ie5.5 does not support this property.

17. innerwidth property

Syntax: window.innerheight = value

Function: Returns the pixel width or specify the document in the browser window, the width of the page does not include any toolbars and composition of the window width modification.

Note: ie5.5 does not support this property.

18. menubar property

Syntax:. Window.menubar property

Function: menubar property can also be seen as a sub-object, this attribute is used to obtain its own visible property to determine the menu bar is visible. So far, the property is only a sub-attributes: visible.

Note: ie5.5 does not support this property.

19. menubar.visible属性

Syntax: window.menubar.visible

Function: menubar.visible property is used to return the menu bar is visible, if visible returns true, and vice versa returns false.

Note: ie5.5 does not support this property.

20. opener property

Syntax:. Window.opener window.opener method window.opener property.

Function: opener to open the properties associated with the parent window, child window when accessing operer property, the return of the parent window. By this property, the parent can use the window object methods and properties.

21. outerheight Properties

Syntax: window.outerheight

Function: outerheight property used to access the browser window height in pixels, including the height of the toolbar and highly decorative edge.

Note: ie5.5 does not support this property.

22. outerwidth property

Syntax: window.outerwidth

Function: outerwidth property is used to access the browser window pixel width, the width including the width of the toolbar and decorative edges.

Note: ie5.5 does not support this property.

23. pagexoffset property

Syntax: window.pagexoffset = value

Function: Specifies the browser window in the current document horizontal pixel position in the upper left corner of the window. Before use moveto movement, this property may be determined by the need to move the window. Because the property returned to the visible document relative to the current position of the entire page.

Note: ie5.5 does not support this property.

24. pageyoffset property

Syntax: window.pageyoffset = value

Function: Specifies the browser window in the upper left corner of the document current vertical pixel location in the window. Before use moveto movement, this property may be determined by the need to move the window. Because the property returned to the visible document relative to the current position of the entire page.

Note: ie5.5 does not support this property.

25. parent property

Syntax: window.parent.frames [value] window.parent.framesname

Features: Access each child window parent window (multi-frame) is located.

26. personalbar property

Syntax:. Window.personalbar property

Function: personalbar property itself is a target for accessing its own visible property to determine individual bar is visible.

Note: ie5.5 does not support this property.

27. personalbar.visible property

Syntax: window.personalbar.visible

Function: Determine individual bar is visible, if visible returns true, otherwise returns false.

Note: ie5.5 does not support this property.

28. scrollbars property

Syntax:. Window.scrollbars property

Function: scrollbars property itself is a target for accessing its own visible property to determine the scroll bar is visible

Note: ie5.5 does not support this property.

29. scrollbars.visible property

Syntax: window.scrollbars.visible

Function: scrollbars.visible used to determine the scroll bar is visible, if visible returns true, otherwise returns false.

Note: ie5.5 does not support this property.

30. toolbar property

Syntax:. Window.toolbar property

Function: toolbar property itself is a target for accessing its own visible attribute to determine the toolbar is visible.

Note: ie5.5 does not support this property.

31. toolbar.visible property

Syntax: window.toolbar.visible

Function: toolbar.visible attribute is used to check whether the toolbar is visible, if visible returns true, otherwise returns false.

Note: ie5.5 does not support this property.

32. top property

Syntax:. Window.top.frames [value] window.top.framename window.top Method ()

window.top. property

Function: top property of the window object contains all the information for the browser loaded child window (multi-frame) of the top-most window.

Guess you like

Origin www.cnblogs.com/zhaodz/p/12057790.html