


Summary of JavaScript Window browser object model methods and properties_javascript skills
Window object
The window object is supported by all browsers. It represents the browser window.
All JavaScript global objects, functions, and variables automatically become members of the window object.
Global variables are properties of the window object.
Global functions are methods of the window object.
1. open method
Grammar format:
window.open(URL, window name, window style)
Function: Open a new window and load the web page with the specified URL address in the window.
Description:
The open method is used to open a new browser window and load a specified URL address in the new window;
When the open method opens a new browser window, you can also specify the name of the window (the second parameter);
When the open method opens 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 multiple times. If multiple selections are made, separate the options with commas:
toolbar: Specifies whether the window has a standard toolbar. When the value of this option is 1 or yes, it means there is a standard toolbar; when the value of this option is 0 or no, it means there is no standard toolbar;
location: Specifies whether the window has an address toolbar. The value and meaning of the option are the same as toolbar;
directories: Specifies whether the window has a link toolbar. The value and meaning of the option are the same as toolbar;
status: Specifies whether the window has a status bar. The value and meaning of the option are the same as toolbar;
menubar: Specifies whether the window has a menu. The value and meaning of the option are the same as toolbar;
scrollbar: Specifies whether there is a scroll bar when the current window document is larger than the window. The value and meaning of the option are the same as toolbar;
resizable: Specifies whether the window can be resized. The value and meaning of the option are the same as toolbar;
width: Specifies the width of the window in pixels, replaced by innerWidth;
height: Specifies the height of the window in pixels, replaced by innerHeight;
outerWidth: Specifies the outer width of the window in pixels;
outerHeight: Specifies the outer height of the window in pixels;
left: Specifies the position of the window from the left side of the screen in pixels;
top: Specifies the position of the window from the top of the screen in pixels;
alwaysLowered: The specified window is hidden behind all windows. The value and meaning of the option are the same as toolbar;
alwaysRaised: The specified window floats on top of all windows. The value and meaning of the option are the same as toolbar;
dependent: Specifies that the opened window is a child window of the current window and will be closed when the parent window is closed. The value and meaning of the option are the same as toolbar;
hotkeys: Set the hotkey for safe exit in a new window without a menu bar. The value and meaning of the option are the same as toolbar;
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 of the window from the left edge of the screen;
screenY: Set the pixel length of the window from the upper border of the screen;
titleBar: Indicates whether the title bar is visible in the new window. The value and meaning of the option are the same as toolbar;
z-look: Indicates that when the window is activated, it cannot float on top of other windows. The value and meaning of the option are the same as toolbar.
The open method returns a reference to the window.
Tip: This method is often used to automatically open another window when opening a web page.
2. close method
Grammar format:
window.close()
Function: The close method is used to automatically close the browser window.
3. alert method
Grammar format:
window.alert(prompt string)
Function: Pop up a warning box and display the prompt string text in the warning box.
4. confirm method
Grammar format:
window.confirm(prompt string)
Function: Display a confirmation box, display the prompt string in the confirmation box, when the user clicks the "OK" button
This method returns true when "Cancel" is clicked and false when "Cancel" is clicked.
5. prompt method
Grammar format:
window.prompt(prompt string, default text)
Function: Display an input box, display the prompt string in the input box, and display the default text
in the input text box
This, and waits for user input, when the user clicks the "OK" button, returns the string entered by the user, when
When the Cancel button is clicked, a null value is returned.
6. setTimeout method
Grammar format:
window.setTimeout(code character expression, milliseconds)
Function: Timing setting, when the specified number of milliseconds is reached, the code character expression is automatically executed.
7. clearTimeout method
Grammar format:
window.clearTimeout(timer)
Function: Cancel the previous timing setting. The parameter is the return value when set with setTimeout.
8. setInterval method
Grammar format:
window.setInterval(code character expression, milliseconds)
Function: After setting a time interval (second parameter), repeatedly execute the content of "code character expression"
9. clearInterval method
Grammar format:
window.clearInterval(time interval)
Function: Cancel the timing set by setInterval. The parameter is the return value of the setInterval method.
10. moveBy method
Grammar format:
window.moveBy(horizontal displacement, vertical displacement)
Function: Move the specified window according to the given pixel parameters. The first parameter is the pixel by which the window moves horizontally, the first parameter is
The two parameters are the pixels by which the window is moved vertically.
11.moveTo method
Grammar format:
window.moveTo(x,y)
Function: Move the window to the specified specified coordinates (x, y).
12. resizeBy method
Grammar format:
window.resizeBy(horizontal,vertical)
Function: Change the current window to the specified size (x, y). When the values of x and y are greater than 0, it is expanded, and when it is less than 0
to reduce.
13. resizeTo method
Grammar format:
window.resizeTo(horizontal width, vertical width)
Function: Change the current window to (x, y) size, where x and y are the width and height respectively.
14. scrollBy method
Grammar format:
window.scrollBy(horizontal displacement, vertical displacement)
Function: Scroll the content in the window according to the given displacement. When the parameter is a positive number, scroll in the forward direction, otherwise it will scroll in the reverse direction
Scroll towards.
15. scrollTo method
Grammar format:
window.scrollTo(x,y)
Function: Scroll the content in the window to the specified position.
16.find method
Grammar format:
window.find()
Function: When this method is triggered, a "find" dialog window will pop up and allow the user to touch
Find a string in the page using the find method.
Note: This attribute is not supported in IE5.5 and Netscape6.0.
17. back method
Grammar format:
window.back()
Function: Simulate the user clicking the "Back" button on the browser to move the page to the previous page of the browser.
Note: This operation can only be performed when the current page has a previous page.
Note: IE5.5 does not support this method, but Netscape6.0 supports it.
18. forward method
Grammar format:
window.forward()
Function: Simulate the user clicking the "Forward" button on the browser to move the page to the next page of the browser.
Note: This operation can only be performed when the next page exists on the current page.
Note: IE5.5 does not support this method, but Netscape6.0 supports it.
19. home method
Grammar format:
window.home()
Function: Simulate the user clicking the "Home" button on the browser to redirect the page to the specified page.
Note: IE5.5 does not support this method, but Netscape6.0 supports it.
20. stop method
Grammar format:
window.stop()
Function: Simulate the user clicking the "Stop" button on the browser to terminate the browser's download operation.
Note: IE5.5 does not support this method, but Netscape6.0 supports it.
21. print method
Grammar format:
window.print()
Function: Simulate the user clicking the "Print" button on the browser and notify the browser to open the print dialog box for printing
Current page.
22. blur method
Grammar format:
window.blur()
Function: Remove focus from the window. Care must be taken when used with the focus method as it may cause focus
Keep moving in and out.
23. focus method
Grammar format:
window.focus()
Function: Make the window focus. Care must be taken when using it with the blur method as it may result in loss of focus
Move in and out.
24. captureEvent method
Grammar format:
window.captureEvent(Event)
window.captureEvent(event1|event2|...|eventn)
Function: Capture all events with specified parameters. Due to the ability to capture events that are handled by the local program itself
, so programmers can freely define functions to handle events. If there are multiple events that need to be captured, each event
Separate them with the pipe character "|". The event types 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
25. enableExternalCapture event
Grammar format:
window.enableExternalCapture(event)
Function: The enableExternalCapture method is used to capture external events passed in through parameters.
26. disableExternalCapture event
Grammar format:
window.disableExternalCapture()
Function: Cancel the setting of the enableExternalCapture method and terminate the capture of external events.
27. handleEvent event
Grammar format:
window.handleEvent(event)
Function: Event handler that triggers the specified event.
28. releaseEvent event
Grammar format:
window.releaseEvent(event)
window.releaseEvent(event1|event2|...|eventn)
Function: Release the captured events passed in through parameters. These events are generated by
The releasable events set by the window.captureEvent method are the same as captureEvent.
29. routeEvent event
Grammar format:
window.releaseEvent(event)
Function: Transfer all events of the captured type to standard event processing methods for processing, things that can be transferred
The file is the same as captureEvent.
30 scroll event
Grammar format:
window.scroll(X coordinate, Y coordinate)
Function: Move the window to the specified coordinate position.
The window object has the following properties:
1. status attribute
Grammar format:
window.status=string
Function: Set or give the current display information of the status bar in the browser window.
Tip: You can use this property to set the browser window status bar information.
2. statusbar attribute
Grammar format:
window.statusbar.property
Function: The statusbar attribute itself is also an object, used to access its own visible attribute to confirm
Determines whether the status bar is visible.
Note: IE5.5 browser does not support this attribute.
3. statusbar.visible property
Grammar format:
window.statusbar.visible
Function: Check whether the status bar is visible. If it is visible, it returns true, otherwise it returns false.
Note: IE5.5 browser does not support this attribute.
4. defaultstatus attribute
Grammar format:
window.defaultstatus[=string]
Function: The defaultstatus attribute value is the default display information of the status bar in the browser window.
5.location attribute
Grammar format:
window.location=URL
Function: Give the URL information of the current window or specify the URL of the open window.
6. locationbar attribute
Grammar format:
window.locationbar.property
Function: The locationbar attribute can also be regarded as a sub-object. This attribute is used to obtain its own
visible property to determine whether the location bar is visible.
So far, this property has only one subproperty: visible.
Note: IE5.5 does not support this attribute.
7. locationbar.visible property
Grammar format:
window.locationbar.visible
Function: Returns whether the location bar is visible. If it is visible, it returns true, otherwise it returns false.
Note: IE5.5 does not support this attribute.
8. self attribute
Grammar format:
window.self.method
window.self.property
Function: This attribute contains the flag of the current window. Using this attribute, you can ensure that multiple windows are opened
In this case, functions or properties within the current window are correctly called without confusion.
9. name attribute
Grammar format:
window.name=name
Function: Returns the window name, which is given when the window.open() method creates a new window.
In the javascript1.0 version, this attribute can only be used to read the window name, and in
In the javascript1.1 version, you can use this attribute to give a
that was not created using the window.open() method.
The window is given a name.
10. closed attribute
Grammar format:
window.closed
Function: The closed attribute is used to return whether the instance of the specified window has been closed. If closed, return true
, otherwise it returns false.
11. frames attribute
Grammar format:
window.frames["frame name"]
window.frames[numeric]
Function: The frames attribute is an array used to store each sub-window created by an element in the document (frame
Frame) instance, where the subscript can be either a sequence number or a name specified using the NAME attribute of the FRAME element
Scale to get and use.
12. frames.length property
Grammar format:
window.frames.length
Function: The frames.length attribute is used to give the number of sub-window (frame) instances in the document.
13. length attribute
Grammar format:
window.length
Function: The length attribute returns the number of sub-windows in a window. This attribute is the same as
The value of the window.frame.length property is the same.
14. document attribute
Grammar format:
window.document.event
window.document.method
window.document.property
Function: The sub-object document of the window object is the core object of javascript.
is encountered in the script
Create an instance of the BODY element.
15. history attribute
Grammar format:
window.history[numeric]
window.history.method()
window.history.property
The sub-object history of the window object is one of the core objects of JavaScript. This attribute contains a
An array of names and URLs of pages that have been visited.
16. innerHeight property
Grammar format:
window.innerHeight=numeric value
Function: Return or specify the pixel height of the document in the browser window. This height does not include any toolbars and
The height of the page decorations that make up the window.
Note: IE5.5 does not support this attribute.
17. innerWidth property
Grammar format:
window.innerHeight=numeric value
Function: Return or specify the pixel width of the document in the browser window. This width does not include any toolbars and
The width of the page decoration that makes up the window.
Note: IE5.5 does not support this attribute.
18. menubar attribute
Grammar format:
window.menubar.property
Function: The menubar attribute can also be regarded as a sub-object. This attribute is used to obtain its own
visible property to determine whether the menu bar is visible.
So far, this property has only one subproperty: visible.
Note: IE5.5 does not support this attribute.
19. menubar.visible property
Grammar format:
window.menubar.visible
Function: menubar.visible property is used to return whether the menu bar is visible. If it is visible, it returns true, otherwise
It returns false.
Note: IE5.5 does not support this attribute.
20. opener attribute
Grammar format:
window.opener
window.opener.method
window.opener.property
Function: The opener attribute is associated with the parent window that opens the window. When accessing the operer attribute in the child window
, the parent window is returned. This property provides access to methods and properties from the parent window object.
21. outerHeight property
Grammar 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 decorative edge.
Note: IE5.5 does not support this attribute.
22. outerWidth attribute
Grammar format:
window.outerWidth
Function: The outerWidth attribute is used to access the pixel width of the browser window, which includes toolbars and devices
The width of the trim.
Note: IE5.5 does not support this attribute.
23. pageXOffset attribute
Grammar format:
window.pageXOffset=numeric value
Function: Specify the current horizontal pixel position of the upper left corner of the document in the browser window in the window. Using
Before movingTo, you can use this property to decide whether the window needs to be moved. Because this attribute returns
The current position of the visible document relative to the entire page.
Note: IE5.5 does not support this attribute.
24. pageYOffset attribute
Grammar format:
window.pageYOffset=numeric value
Function: Specify the current vertical pixel position of the upper left corner of the document in the browser window in the window. Using
Before movingTo, you can use this property to decide whether the window needs to be moved. Because this attribute returns
The current position of the visible document relative to the entire page.
Note: IE5.5 does not support this attribute.
25. parent attribute
Grammar format:
window.parent.frames[numeric]
window.parent.framesName
Function: Access the parent window where each child window (multi-frame) is located.
26. personalbar attributes
Grammar format:
window.personalbar.property
Function: The personalbar attribute itself is also an object, which is used to access its own visible attribute to confirm
Determine whether the personal column is visible.
Note: IE5.5 does not support this attribute.
27. personalbar.visible property
Grammar format:
window.personalbar.visible
Function: Determine whether the personal column is visible. If it is visible, it returns true, otherwise it returns false.
Note: IE5.5 does not support this attribute.
28. scrollbars properties
Grammar format:
window.scrollbars.property
Function: The scrollbars attribute itself is also an object, which is used to access its own visible attribute to confirm
Determines whether the scroll bar is visible.
Note: IE5.5 does not support this attribute.
29. scrollbars.visible property
Grammar format:
window.scrollbars.visible
Function: scrollbars.visible is used to determine whether the scroll bar is visible. If it is visible, it returns true, otherwise
It returns false.
Note: IE5.5 does not support this attribute.
30. toolbar attribute
Grammar format:
window.toolbar.property
Function: The toolbar attribute itself is also an object, used to access its own visible attribute to determine
Whether the toolbar is visible.
Note: IE5.5 does not support this attribute.
31. toolbar.visible property
Grammar format:
window.toolbar.visible
Function: toolbar.visible property is used to check whether the toolbar is visible, and returns true if visible,
Otherwise, return false.
Note: IE5.5 does not support this attribute.
32. top attribute
Grammar format:
window.top.frames[numeric]
window.top.frameName
window.top.method()
window.top.property
Function: The top attribute of the window object is used to contain information about the top-most window of all sub-windows (multi-frames) loaded into the browser.
The above is the entire content of this article, I hope you all like it.

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











WeChat is one of the mainstream chat tools. We can meet new friends, contact old friends and maintain the friendship between friends through WeChat. Just as there is no such thing as a banquet that never ends, disagreements will inevitably occur when people get along with each other. When a person extremely affects your mood, or you find that your views are inconsistent when you get along, and you can no longer communicate, then we may need to delete WeChat friends. How to delete WeChat friends? The first step to delete WeChat friends: tap [Address Book] on the main WeChat interface; the second step: click on the friend you want to delete and enter [Details]; the third step: click [...] in the upper right corner; Step 4: Click [Delete] below; Step 5: After understanding the page prompts, click [Delete Contact]; Warm

Unfortunately, people often delete certain contacts accidentally for some reasons. WeChat is a widely used social software. To help users solve this problem, this article will introduce how to retrieve deleted contacts in a simple way. 1. Understand the WeChat contact deletion mechanism. This provides us with the possibility to retrieve deleted contacts. The contact deletion mechanism in WeChat removes them from the address book, but does not delete them completely. 2. Use WeChat’s built-in “Contact Book Recovery” function. WeChat provides “Contact Book Recovery” to save time and energy. Users can quickly retrieve previously deleted contacts through this function. 3. Enter the WeChat settings page and click the lower right corner, open the WeChat application "Me" and click the settings icon in the upper right corner to enter the settings page.

Colorful motherboards enjoy high popularity and market share in the Chinese domestic market, but some users of Colorful motherboards still don’t know how to enter the bios for settings? In response to this situation, the editor has specially brought you two methods to enter the colorful motherboard bios. Come and try it! Method 1: Use the U disk startup shortcut key to directly enter the U disk installation system. The shortcut key for the Colorful motherboard to start the U disk with one click is ESC or F11. First, use Black Shark Installation Master to create a Black Shark U disk boot disk, and then turn on the computer. When you see the startup screen, continuously press the ESC or F11 key on the keyboard to enter a window for sequential selection of startup items. Move the cursor to the place where "USB" is displayed, and then

Tomato Novel is a very popular novel reading software. We often have new novels and comics to read in Tomato Novel. Every novel and comic is very interesting. Many friends also want to write novels. Earn pocket money and edit the content of the novel you want to write into text. So how do we write the novel in it? My friends don’t know, so let’s go to this site together. Let’s take some time to look at an introduction to how to write a novel. Share the Tomato novel tutorial on how to write a novel. 1. First open the Tomato free novel app on your mobile phone and click on Personal Center - Writer Center. 2. Jump to the Tomato Writer Assistant page - click on Create a new book at the end of the novel.

Mobile games have become an integral part of people's lives with the development of technology. It has attracted the attention of many players with its cute dragon egg image and interesting hatching process, and one of the games that has attracted much attention is the mobile version of Dragon Egg. To help players better cultivate and grow their own dragons in the game, this article will introduce to you how to hatch dragon eggs in the mobile version. 1. Choose the appropriate type of dragon egg. Players need to carefully choose the type of dragon egg that they like and suit themselves, based on the different types of dragon egg attributes and abilities provided in the game. 2. Upgrade the level of the incubation machine. Players need to improve the level of the incubation machine by completing tasks and collecting props. The level of the incubation machine determines the hatching speed and hatching success rate. 3. Collect the resources required for hatching. Players need to be in the game

A summary of how to obtain Win11 administrator rights. In the Windows 11 operating system, administrator rights are one of the very important permissions that allow users to perform various operations on the system. Sometimes, we may need to obtain administrator rights to complete some operations, such as installing software, modifying system settings, etc. The following summarizes some methods for obtaining Win11 administrator rights, I hope it can help you. 1. Use shortcut keys. In Windows 11 system, you can quickly open the command prompt through shortcut keys.

Detailed explanation of Oracle version query method Oracle is one of the most popular relational database management systems in the world. It provides rich functions and powerful performance and is widely used in enterprises. In the process of database management and development, it is very important to understand the version of the Oracle database. This article will introduce in detail how to query the version information of the Oracle database and give specific code examples. Query the database version of the SQL statement in the Oracle database by executing a simple SQL statement

Setting font size has become an important personalization requirement as mobile phones become an important tool in people's daily lives. In order to meet the needs of different users, this article will introduce how to improve the mobile phone use experience and adjust the font size of the mobile phone through simple operations. Why do you need to adjust the font size of your mobile phone - Adjusting the font size can make the text clearer and easier to read - Suitable for the reading needs of users of different ages - Convenient for users with poor vision to use the font size setting function of the mobile phone system - How to enter the system settings interface - In Find and enter the "Display" option in the settings interface - find the "Font Size" option and adjust it. Adjust the font size with a third-party application - download and install an application that supports font size adjustment - open the application and enter the relevant settings interface - according to the individual
