Window object properties

xiaoxiao2021-04-01  227

Window object properties

Skilled window object open, close, alert, that use confirm, prompt, setTimeout, clearTimeout, setInterval, clearInterval, moveBy, resizeBy, scrollBy method moveTo, resizeTo, scrollTo, print process control window object master status window object Using the WINDOW object using the WINDOW object, the WINDOW object is one of the highest level objects of the client JavaScript, as long as the browser window is opened, regardless of the open web page in the window, when encountering the body, frameset or frame elements, Always create an instance of a 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. Method 6-2-1 window object 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: Open a new window and load the web 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 also specify the style of the window (the third parameter), the window style has the following options, these options can be selected, if multiple selection, each option is separated by commas : 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, there is no standard toolbar; local: Specifies whether the window has an address toolbar, the value of the option and meaning Toolbar; Directories: Specifies whether the window has a link toolbar, the value of the option is the same as Toolbar; Status: Specifies the value of the window, the value of the option is the same as Toolbar; MenuBar: Specifies whether the window has a menu, option The value and meaning are the same as Toolbar; ScrollBar: Specifies whether there is a scroll bar when the current window document is greater than the window, the value of the option is the same as Toolbar; Resizable: Specifies whether the window can change the size, the value of the option and the meaning of the option; Width: The width of the window specified in pixels is already replaced by INNERWIDTH; Height: The height of the window specifies the window in pixels, has been replaced by InnerHeight; OuterWidth: The external width of the window specifies the window in pixels; OuterHeight: Specify the window in pixels External height; Left: Specifies the location of the window from the left side of the window in pixels; Top: Specifies the position of the window at the top of the window from the pixel; alwayslowered: The specified window is hidden after all windows, the value and meaning of the option are the same as Toolbar. ALWAYSRAISED: The specified window floats above all the windows, the value of the option is the same as Toolbar; Dependent: Specifies the open window as a sub-window of the current window, and close, the value of the option and meaning as the parent window The same as Toolbar; HotKeys: Sets the security exit hot button in a new window without a menu bar, the value of the option is the same as Toolbar; InnerHeight: Sets the pixel height of the document in the window; InnerWidth: Set the pixels of documents in the window Width; Screenx: Set the pixel length of the left side of the window; Screeny: Set the pixel length of the window on the point of the window; Titlebar: Indicates whether the title bar can be seen in the new window, the value of the option and the meaning of the option; z -look: Indicates that when the window is activated, the value and meaning of the option are the same as the Toolbar when the window is activated. 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: Prepare a small program, which is used to automatically open another window when opening the current window, requires that the window does not have a standard toolbar, address bar, link toolbar, menu bar, but there is a status bar, window The web page address opened in: http://www.zzia.edu.cn

.

2. Close Method Language: Window.close () Function: Close method is used to automatically turn off the browser window. 3. ALERT Method Format: Window.alert (prompt string) Function: Pop up a warning box, display a prompt string text in the warning box. 4. Confirm Method Format: Window.confirm (prompt string) Function: Display a confirmation box, display the prompt string within the confirmation box, the method returns True when the user clicks the "OK" button, click "Cancel" Returns false. 5. PROMPT Method Format: WINDOW.PROMPT (prompt string, default text) Function: Display a input box, display a prompt string in the input box, display the default text in the input text box, and wait for the user to enter, When the user clicks the "OK" button, the user returns the string entered by the user. When you click the "Cancel" button, return the NULL value. 6. SETTIMEOUT Method Format: WINDOW.SETTIMEOUT (Code Character Expression, Mixing) Function: Timed Settings When the number of specified milliseconds, the code character expression is automatically executed. 7. Cleartimeout Method Format: Window.cleArtimeout (Timer) Function: Cancel the previous timing setting, where the parameters are returned when setting the setTimeout. 8. SETINTERVAL Method Format: WINDOW.SetInterval (Code Character Expression, Mix) Function: After setting up a time interval (second parameter), repeatedly perform "Code Character Expressions" 9. ClearInterval Method Format : WINDOW.CLEARINTERVAL: Cancel the timing of SetInterval settings. The parameters are the return value of the SETINTERVAL method. 10. Moveby Method Format: WINDOW.MOVEBY (horizontal displacement, vertical shift) function: Move the specified window according to the given pixel parameter. The first parameter is a pixel that is horizontally moving, and the second parameter is a pixel moving perpendicular to the window. 11.Moveto Method Format: Window.Moveto (X, Y) Function: Move the window to the specified specified coordinate (x, y). 12. Resizeby Method Format: Window.resizeby (horizontal, vertical) function: Change the current window to change the specified size (x, y), when X, Y is greater than 0, and is reduced when it is less than 0. 13. ResizTo 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 Format: WINDOW.Scrollby (horizontal displacement, vertical shift) function: scroll the content in the window by a given bit shift. When the parameter is positive, scroll forward, otherwise it is rolled back. 15. ScrollTo Method Format: Window.Scrollto (X, Y) Function: Scroll the content in the window to the specified location. 16.Find Method Format: Window.Find () Features: When the method is triggered, a "Find" dialog window will pop up and allow the user to find a string in a page that is triggering the Find method. Note: This property is not supported in IE5.5 and Netscape6.0.

17. BACK Method Format: Window.back () Features: Simulates the "Back" button on your browser to go to the browser's previous page. 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 Dictionarity: Window.Forward () Features: Simulates the "Forward" button on your browser to go to the browser's next page. 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 Format: Window.home () Features: Simulates the "Home" button on your browser to transfer the page to the specified page. Note: IE5.5 does not support this method, Netscape6.0 support. 20. STOP Method Language: Window.Stop () Features: Simulates the "Stop" button on your browser to terminate the browser's download operation. Note: IE5.5 does not support this method, Netscape6.0 support. 21. Print Method Format: Window.Print () Features: Simulates the Print button to click on the browser to inform the Browser to open the print dialog to print the current page. 22. BLUR Method Format: Window.blur () Features: Lead the focus from the window. Be careful when combined with the FOCUS method, because it may cause focus to move forward into the move. 23. Focus method language format: Window.focus () Features: Get the window to get the focus. Be careful when it is combined with the blur method, because it may cause focus to move forward into moving out 24. CaptureEvent Method Format: Window.captureEvent (Event) Window.captureEvent (Event 1 | Event 2 | ... | Event N) Features: Capture Specify all events of the parameter. Since it is possible to capture an event handled by the local program, the programmer can define the function to handle the event. If there are multiple events that need to be captured, each event is separated by pipes "|". 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 event syntax: window.enableexternalcapture (event) function: enableexternalcapture method for capturing parameter passing External events. 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) Features: Trigger the event processor for the specified event.

28. ReleaseEvent event syntax format: Window.releaseEvent (Event) Window.releaseEvent (Event 1 | Event 2 | ... | Event N) Features: Release the captured event passed through parameters, these events are Window. If the 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 translated event 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 window object attribute 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 property 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 property to determine if the status bar is visible. Note: This property is not supported by IE5.5 browser. 3. Statusbar.visible Property Syntax Format: Window.statusBar.visible Features: Check if the status bar is visible, if you can return 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 property syntax format: Window.Location = URL function: give the current window URL information or specify the URL of the window. 6. LocationBar Property Syntax format: Window.LocationBar. Properties: LocationBar properties can also be seen as a sub-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 function: Back to the location bar is visible, 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, which ensures that the function in the current window can be invoked correctly when multiple windows are opened. Or attribute without chaos. 9. Name Property 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, and when it comes to the JavaScript1.1 version, you can use this attribute to specify a name for a window not created with a Window.Open () method. 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 TRUE, turn back to flash. 11. Frames Property Syntax Format: Window.frames ["Frame Name"] Window.frames [Value] Function: Frames property is an array to store each sub-window (framework) instance created by elements in the document, where The subscript can be the sequence number or the name specified by the name attribute of the FRAME element to be used and used. 12. Frames.Length Property Syntax Format: Window.frames.Length Function: Frames.Length Attributes The number of documents (framework) instances are given.

13. LENGTH Property Syntax format: Window.Length function: The length property returns the number of sub-windows in a window, which is the same as the value of the Window.frame.length property. 14. Document property syntax format: window.document. Method Window.Document. Property feature: Sub-object Document for the Window object is the core object of JavaScript and creates an instance when you encounter a body element in the script. 15. History property syntax format: window.history [Value] WINDOW.HISTORY. Method () WINDOW.HISTORY. Subjects for Window Object History is one of the core objects of JavaScript, which contains a name that has visited the page. And the array of URLs. 16. InnerHeight property syntax format: Window.innerHeight = Numerical 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 constituent window. Note: This property does not support IE5.5. 17. InnerWidth property syntax format: Window.innerHeight = Numerical function: Return or specify the pixel width of the document in the browser window, this width does not include any toolbar and the page modification width of the set 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 its own Visible property 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 Features: MenuBar.visible property is used to return to the menu bar to be visible, if you can see Return true, the counter returns false. Note: This property does not support IE5.5. 20. Opener Property Syntax Format: Window.openerWindow.opener. Method WINDOW.Opener. Property Features: Opener Attribute is associated with the parent window that opens the window, returns the parent window when the Operer property in the sub-window is accessed. 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 the height of the toolbar and decorative side. Note: This property does not support IE5.5. 22. OuterWidth Property Syntax: Window.outerwidth Function: OuterWidth property is used to access the pixel width of the browser window, which includes the width of the toolbar and the decorative side. Note: This property does not support IE5.5. 23. PageXoffset Property Syntax Format: Window.pagexOffset = Value Function: Specify the current horizontal pixel location in the left corner of the browser window in the window. Before using MoveTo move, you can decide whether to move the window. Because this property returns the current location of the visible document relative to the entire page. Note: This property does not support IE5.5. 24. PageYoffset Property Syntax Format: Window.pageyOffset = Numerical Function: Specifies the current vertical pixel location in the top left corner of the browser window in the window.

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

New Post(0)