8.1window ObjectsThe core object of the BOM is window, which represents an instance of the browser. The Window object has a dual role, either through the interface that accesses the browser window or the global object specified by the ECMAScript
8.1.1 Global ScopeThe difference between defining a global variable and defining a property directly on a Window object is that the global variable cannot be deleted by the delete operator, but the properties of the defined property of the Window object can be common sense to access undeclared variables and throw an error. But by querying the window object you can tell if an undeclared variable exists
8.1.2 window relationship and framework
If there are frames in the page, each frames has its own window object and is saved in the Frames object.
You can use Window.frames[0] or window.frames[framesname] to refer to the frame
8.1.3 the location of the window
MoveTo (): Receives the x, Y coordinate value of the new location
Moveby (): Receives the number of pixels moving in both horizontal and vertical directions
8.1.4 Window Size
Resizeto (): Receives the new width and new height of the browser window
Resizeby (): Receives the difference between the width and height of the new window and the original window
var pagewidth = window.innerwidth,
PageHeight = Window.innerheight;
if (typeof pagewidth! = ' number ') {
if (Document.compatmode = = ' Css1compat ') {
PageWidth = Document.documentElement.clientWidth;
PageHeight = Document.documentElement.clientHeight;
} else {
PageWidth = Document.body.clientWidth;
PageHeight = Document.body.clientHeight;
}
}
Firefox,safari,opera and Chrome have 4 properties: Innerwidth,innerheight,outerwidth,outerheight. Returns the size of the browser window itself in Safari and Firefox,outerwidth and Outerheight. These two properties in opera represent the size of the Page view container. Innerwidth and innerheight represent the size of the Page view area in the container. In Chrome, Outerwidth,outerheight returns the same value as Innerwidth,innerheight, which is the size of the viewport, not the size of the browser window.
In IE6 Standard mode: Document.documentElement.clientWidth, Document.documentElement.clientHeight these two values are valid, while in promiscuous mode: by Document.body.clientwidth,document.body.clientheight, The same values can be obtained in both of these ways under Chrome.
8.1.5 Navigating and opening windows
window.open ();
8.1.6 Intermittent Call and timeout call settimeout (), setinterval (); 8.1.7 System dialog box alert (), confirm () and prompt ();
8.2location ObjectsLocation provides information about documents loaded in the current window it is both a Window object and a Document object
8.2.1 Query string parametersLocation.search returns everything from the question mark to the end of the URL, but there is no way to access each of these query string parameters individually
8.2.2 Position OperationLocation.href () Creates a new record in the browser by Location.href, so the user clicks the Back button to navigate to the previous page, and to disable this behavior, you can use the Location.replace method. Location.reload (): Reload (possibly loaded from cache) Location.reload (true): Reload (reload from server);
JS Advanced Programming Eighth BOM (not completed, to be continued)