JS Window
Window object: http://www.w3school.com.cn/js/js_window.asp
All browsers support window objects. It represents a browser window.
All JavaScript global objects, functions, and variables automatically become members of the window object.
Properties and method formats of window objects:
[window.] attribute
[window.] method (parameters)
Even the document of HTML DOM is one of the properties of the window object:
window.document.getElementById("header");
Same as this:
document.getElementById("header");
JS Screen
Screen object: http://www.w3school.com.cn/js/js_window_screen.asp
The screen object mainly describes the display and color properties of the screen.
Properties of screen objects:
Format: screen.properties
screen.availWidth - Available screen width
screen.availHeight - Available screen height
In pixels, subtract interface characteristics, such as window taskbar.
JS Location
Location object: http://www.w3school.com.cn/js/js_window_location.asp
The location object is used to represent the URL information of a specific window.
The window.location object can not be written without the window prefix.
Some examples:
location.hostname Returns the domain name of the web host
location.pathname Returns the path and file name of the current page
location.port Returns the port of the web host (80 or 443)
location.protocol Returns the web protocol used (http:// or https://)
The location.href property returns the URL of the current page.
The location.assign() method loads the new document.
JS History
Historical object: http://www.w3school.com.cn/js/js_window_history.asp
A historical object is used to store a list of URLs recently visited by the client.
To protect user privacy, restrictions are imposed on how JavaScript accesses the object.
Some methods:
history.back() - Same as clicking the back button in the browser
history.forward() - Same as clicking the button forward in the browser
File Object
File object: represents the current HTML object, consisting of the <body> tag group, and a file object will be automatically created for each HTML file.
Format:
document.properties
document.Method (parameters)
Link Objects
The links in the web page will be automatically regarded as link objects and are represented as document.links[0] and document.links[1] in order...
Define the format of the link object:
String.link(property)
Form Object
A child object of the file object. Javascript's runtime engine automatically creates a form object for each form.
Format:
document.forms[index].properties
document.forms[index].Methods (parameters)
document.Form name.Properties
document.Form name.Method (parameters)