Window object properties

xiaoxiao2021-03-18  200

Open window object properties skilled window object, close, alert, that use confirm, prompt, setTimeout, clearTimeout, setInterval, clearInterval, moveBy, resizeBy, scrollBy method moveTo, resizeTo, scrollTo, print process control window object master window The use of STATUS, LOCATION, NAME, SELF, and Opener properties are one of the highest level objects of client JavaScript, as long as the browser window is opened, regardless of the open web page in the window, when you encounter Body, Frameset or Frame Elements are automatically created an instance of the Window object. In addition, the example of the object can also be created by a Window.Open () method. Since the WINDOW object is a common ancestor of most of the object, when the method and attribute of the Window object can be omitted, the reference to the Window object can be omitted. For example: window.document.write () can be short-stored: Document.write (). An instance name of the window can be saved when any method and properties of this window object are sent in the window. For example, when setting the Status property to the current MyWIN window, you can use only STATUS without mywin.status. However, instance names must be used when calling the Location property, a close () method, or an OPEN () method in the event processing.

6-2-1 Window objects of the Window object have 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: Open a new window and load the page of the specified URL address in the window.

Description:

Open method is used to open a new browser window and load a specified URL address in a new window.

Open method When opening a new browser window, you can specify the name of the window (second parameter); Open method When opening a new browser window, you can specify the window of the window (third parameter) ,

Window style has the following options, these options can be selected, if multiple selection, each option is separated by a comma: Toolbar: Specifies whether the window has a standard toolbar. When the value of this option is 1 or YES, it is a standard

Toolbar, when the value of this option is 0 or NO, indicates that there is no standard toolbar; local: Specifies whether the window has an address toolbar, the value of the option is the same as Toolbar; Directories: Specifies whether the window has a link toolbar, option The value and meaning are the same as ToolBar; Status: Specifies whether the window has a status bar, the value of the option is the same as Toolbar; Menubar: The value of the window has the menu, the value of the option is the same; ScrollBar: Specifies the current window document is greater than Whether there is a scroll bar when the window, the value of the option and the meaning of the option are

Toolbar; resizable: Specifies whether the window can change the size, the value of the option is the same as Toolbar; Width: The width of the window specifies the window in pixels, has been replaced by INNERWIDTH; Height: The height of the pixel is specified in units, has been InnerHeight replacement; OuterWidth: The external width of the window is specified in pixels; OuterHeight: The external height of the window is specified in pixels; Left: Specifies the location of the window from the left side of the screen in pixels; TOP: Specifies the window distance in pixels The location of the top of the screen; Alwayslowered: The specified window is hidden after all windows, the value of the option is the same as Toolbar; Alwaysraiad: The specified window is floating above all the windows, the value of the option is the same as Toolbar; Dependent: Specify the open window For a child window of the current window and close as the parent window

Off, the value of the option and the meaning are the same as Toolbar;

HotKeys: Setting the security exit hot keys in a new window without a menu bar, the value of the option and the meaning of the option

Toolbar is the same;

InnerHeight: Set the pixel height of the document in the window;

InnerWidth: Set the pixel width of the document in the window;

Screenx: Set the pixel length from the left boundary of the window;

Screeny: Sets the length of the pixel length on the point of the window;

Titlebar: Indicates whether the title bar is visible in a new window, the value of the option is the same as Toolbar;

Z-Look: Indicates that when the window is activated, the value and meaning of the option cannot be floated on other windows.

Toolbar is the same.

The OPEN method returns the reference to this window.

Tips: This method is often used to automatically open another window when opening a web page.

Example 6-2-1: Develop a small program, it is used to automatically open another window when opening the current window,

Ask the window without a standard toolbar, address bar, link toolbar, menu bar, but there is a status bar, play in the window

The open web address is: http://www.dlrtvu.edu.cn.

2. Close method language format:

Window.close () Function: Close method is used to automatically close the browser window.

3. Alert method language format:

Window.alert features: Pop up a warning box and display a prompt string text in the warning box.

4. Confirm method language format:

Window.confirm function: Display a confirmation box, display a prompt string within the confirmation box, when the user clicks the "OK" button

When this method returns true, return false when you click Cancel.

5. PROMPT method language:

Window.Prompt (prompt string, default text) feature: Display a input box, display a prompt string within the input box, display the default text in the input text box

Book, and wait for the user to enter, return the string input by the user when the user clicks the "OK" button,

When you click the Cancel button, return a null value.

6. SETTIMEOUT Method Format:

Window.SetTimeout function: Timed settings, automatically perform code character expressions when the specified millisecond number is obtained. 7. Cleartimeout Method Format:

Window.cleartimeout (Timer) function: Cancel the previous timing setting, where the parameters are set to the return value when setting with SetTimeout.

8. SETINTERVAL Method Method Format:

WINDOW.SETINTERVAL function: After setting a time interval (second parameter), repeatedly execute "code character expressions"

9. ClearInterval method language format:

WINDOW.CLEARINTERVAL: Cancel the timing settings for SetInterval. The parameters are the return value of the SETINTERVAL method.

10. Moveby method language:

Window.Moveby (horizontal displacement, vertical shift) function: Move the specified window according to the given pixel parameter. The first parameter is a pixel that moves horizontally,

Two parameters are pixels that move vertically.

11.Moveto method language format:

Window.moveto (X, Y) function: Move the window to the specified specified coordinate (x, y).

12. Resizeby Method Method Format:

Window.resizeby (horizontal, vertical) function: Change the current window to the specified size (x, y), when the value of x, y is larger than 0, when less than 0

To shrink.

13. ResizTo Method Method Format:

Window.resizETO (horizontal width, vertical width) function: Change the current window to (X, Y) size, X, Y is width and height, respectively.

14. Scrollby method language:

WINDOW.SCROLLBY (horizontal displacement, vertical shift) function: scroll in the window in a given bit shift. When the parameter is positive, scroll forward, otherwise

Rolling.

15. ScrollTo Method Format:

Window.ScrollTo (X, Y) function: scroll the content in the window to the specified location.

16.Find method language format:

Window.Find () function: When the method is triggered, a "Find" dialog window will pop up and allow the user to contact

Find a string in the page of the Find method.

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

17. BACK Method Format:

Window.back () function: Simulates the "Back" button on the browser to go to the browser on the browser.

Description: This operation can only be made only when the current page exists.

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

18. Forward Method Format:

Window.forward () Features: Simulates the user to click the "Forward" button on the browser to go to the next page of the browser.

Note: This operation can only be performed only when the current page exists next page.

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

19. HOME method language format:

Window.home () function: Simulates the "Home" button on the browser to transfer the page to the specified page.

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

20. STOP method language format:

Window.Stop () function: Simulates the "Stop" button on the browser to terminate the browser's download operation.

Note: IE5.5 does not support this method, Netscape6.0 support. 21. Print method language format:

Window.print () function: Simulates the "Print" button on your browser to notify the browser to open the print dialog

current page.

22. BLUR Method Dictionary:

Window.blur () Features: Lead the focus from the window. Be careful when combined with the FOCUS method, because it can cause focus

Continuous movement into the removal.

23. Focus method language format:

Window.focus () Features: Get the window to get the focus. Care must be careful when combined with the blur method because it may cause the focus

The shift moves out.

24. CaptureEvent Method Format:

Window.captureEvent (event) Window.captureEvent (Event 1 | Event 2 | ... | Event N) Features: Capture all events for specified parameters. Since the event can be captured by the local program owning events

, The programmer can define the function at will to process the event. If there are multiple events that need to be captured, each event

Between pipes "|". The captured event type is 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 event

Grammar format:

Window.EnableExternalCapture (event) Features: EnableExternalCapture method is used to capture external events passed through parameters.

26. DisableexternalCapture event syntax format:

Window.disableExternalCapture () Features: Cancel the setting of the EnableExternalCapture method, terminate capture of external events.

27. Handleevent event syntax format:

Window.handleEvent (Event) function: Trigger the event processor for the specified event.

28. ReleaseEvent event syntax format:

WINDOW.RELESEEVENT (EVENT) Window.releaseEvent (Event 1 | Event 2 | ... | Event N) Features: Release the captured event passed through parameters, these events are

If the Window.captureEvent method is set, the releaseable event is the same as CaptureEvent.

29. RouteEvent event syntax format:

WINDOW.RELEASEEVENT (EVENT) Function: Transfer all events of the captured type to the standard event processing method for processing,

The piece is the same as CaptureEvent.

30 Scroll event syntax format:

Window.Scroll (X coordinate, y coordinate) function: Move the window to the specified coordinate position.

6-2-2 Attributes of the Window object The Window object has the following properties:

STATUS

STATUSBAR

Statusbar.visible

DefaultStatus

Location

LocationBar

LocationBar.visibilitySelf

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 format:

Window.status = String function: Set or give the current display information of the status bar in the browser window.

Tips: You can use this property to set the browser window status bar information.

2. Statusbar property syntax format:

Window.statusbar. Properties: The statusbar property itself is also an object that is used to access its own Visible properties.

Whether the status bar is visible.

Note: This property is not supported by IE5.5 browser.

3. statusbar.visible property syntax format:

Window.statusbar.visible feature: Check if the status bar is visible, if you can see True, return to false.

Note: This property is not supported by IE5.5 browser.

4. DEFAULTSTATUS Property Syntax format:

Window.defaultStatus [= string] function: defaultstatus property value is the default display information of the status bar in the browser window

5.Location attribute syntax format:

Window.location = URL function: gives the URL information of the current window or the URL that specifies the open window.

6. LocationBar property syntax format:

Window.LocationBar. Property feature: LocationBar property can also be seen as a child object, this property is used to get its own

Visible property to determine if the location bar is visible.

So far, this property has only one subtribracle: Visible.

Note: This property does not support IE5.5.

7. LocationBar.visible property syntax format:

Window.LocationBar.visible feature: Back to the location bar, if you can see Return true, turn back to false.

Note: This property does not support IE5.5.

8. SELF property syntax format:

WINDOW.SELF. Method WINDOW.SELF. Properties: This property contains the logo of the current window, using this property, can be guaranteed to be opened in multiple windows

In case, the function or attribute within the current window is called correctly without chaos.

9. Name attribute syntax format:

Window.name = Name Features: Return to the window name, this name is given when you create a new window by a Window.Open () method.

In the JavaScript1.0 version, this property can only be used to read the window name, but

When the JavaScript1.1 version, this property can be used to create it to a Window.Open () method.

The window specifies a name.

10. Closed property syntax format:

WINDOW.CLOSED function: The closed property is used to return the instance of the specified window has been turned off. If it is closed, return to TRUE

And violate Flase.

11. Frames property syntax format:

Window.frames ["Frame Name"] Window.frames [Value] Function: Frames property is an array that stores each sub-window (framework) instance created by the document, where the subscript can be a secondary number It can also be the name specified by the name attribute of the FRAME element.

Call and use it.

12. Frames.length attribute syntax format:

Window.frames.Length features: frames.length properties are used to give the number of subsequent subsets instances.

13. Length attribute syntax format:

Window.Length function: The length property returns the number of sub-windows in a window, this property is

The value of the Window.frame.length attribute is the same.

14. Document property syntax format:

Window.Document. Method WINDOW.Document. Properties: Sub-objects for Window Objects Document are core objects of JavaScript, encountered in the script

An instance is created when a Body element is created.

15. History property syntax format:

WINDOW.HISTORY. Method () WINDOW.HISTORY. Property The child object History is one of the core objects of JavaScript, which contains one

The name of the page has been accessed and an array of URLs.

16. InnerHeight property syntax format:

WINDOW.INNNERHEIGHT = Value function: Return or specify the pixel height of the document in the browser window, this height does not include any toolbar and

The page modification height of the page constitutes the window.

Note: This property does not support IE5.5.

17. InnerWidth property syntax format:

WINDOW.INNNERHEIGHT = Value: Return or specify the pixel width of the document in the browser window, this width does not include any toolbar and

The page modifier width of the constituent window.

Note: This property does not support IE5.5.

18. MenuBar property syntax format:

Window.Menubar. Properties: MenuBar properties can also be seen as a child object, this property is used to get itself

Visible properties to determine if the menu bar is visible.

So far, this property has only one subtribracle: Visible.

Note: This property does not support IE5.5.

19. MenuBar.visible property syntax format:

Window.MenuBar.visible feature: MenuBar.visible property is used to return to the menu bar, if you can see Returns True,

Returns false.

Note: This property does not support IE5.5.

20. Opener property syntax format:

WINDOW.OPENERWINDOW.OPENER. Method WINDOW.Opener. Properties: Opener Attribute is connected to the parent window to open the window, when the Operer property is in the sub-window

, Returning is the parent window. By this property, the methods and properties in the parent window object can be used.

21. OuterHeight property syntax format:

Window.outerHeight function: OuterHeight property is used to access the pixel height of the browser window, which includes toolbar and

The height of the decorative side.

Note: This property does not support IE5.5.

22. OuterWidth property syntax format:

Window.outerwidth function: OuterWidth property is used to access the pixel width of the browser window, which includes toolbar and

The width of the decorative side.

Note: This property does not support IE5.5. 23. PagexOffset property syntax format:

Window.pagexoffset = Numerical function: Specify the current horizontal pixel location in the left corner of the browser window in the window in the window. Use

Before MoveTo moves, you can decide whether to move the window. Because this property is returned

It can be seen that the document relative to the current location of the entire page.

Note: This property does not support IE5.5.

24. PageYoffset property syntax format:

WINDOW.PAGEYOFFSET = Value function: Specify the current vertical pixel position in the top left corner of the browser window in the window. Use

Before MoveTo moves, you can decide whether to move the window. Because this property is returned

It can be seen that the document relative to the current location of the entire page.

Note: This property does not support IE5.5.

25. Parent attribute syntax format:

Window.Parent.frames [Value] Window.Parent.framesName Features: Access the parent window where each sub-window (multi-frame) is located.

26. PersonalBar property syntax format:

Window.PersonAlbar. Property feature: The PersonalBar property itself is also an object that is used to access its own Visible properties.

Symptony is visible.

Note: This property does not support IE5.5.

27. PersonalBar.visible property syntax format:

Window.PersonalBar.visible features: Determine if the personal column is visible, if you can see True, turn back to false.

Note: This property does not support IE5.5.

28. ScrollBars attribute syntax format:

Window.Scrollbars. Property feature: The scrollbars property itself is also an object that is used to access its own Visible property.

Whether the scroll bar is visible.

Note: This property does not support IE5.5.

29. Scrollbars.visible property syntax format:

Window.scrollbars.visible feature: scrollbars.visible is used to determine if the scroll bar is visible, if you can see Retur,

Returns false.

Note: This property does not support IE5.5.

30. Toolbar attribute syntax format:

Window.toolbar. Properties: Toolbar property itself is also an object that is used to access its own Visible property to determine

Whether the toolbar is visible.

Note: This property does not support IE5.5.

31. Toolbar.visible property syntax format:

Window.toolbar.visible features: Toolbar.visible properties are used to check if the toolbar is visible, if you can see True,

Ease returns false.

Note: This property does not support IE5.5.

32. TOP attribute syntax format:

WINDOW.TOP.FRAMES [Value] Window.top.FrameNameWindow.top. Method () Window.top. Properties: Window object's TOP properties are used to include all the top-up browser's top window (multi-frame)

The information of the layer window.

转载请注明原文地址:https://www.9cbs.com/read-130016.html

New Post(0)