Browser object model, the Window object is the core of all objects in the BOM bom--browserA, properties
1. (Location type-get the location of the browser)
Ie:
Window.screenleft get the left margin of the browser from the upper left corner of the screen
Window.screentop get the top margin of the browser from the upper-left corner of the screen
FF:
ScreenX
ScreenY
2. Get the browser size
Window.innerwidth get the width of the window
Window.innerheight get the height of the window
3. Relationship Types
Frames under Frame
Window.parent Return to parent window
Window.top returns to the topmost ancestor window
Self returns a reference to the current window. Equivalent to the Window property
4.stutas set the text of the window status bar ( Many browsers have turned off the ability to script their status bar, details of their own Baidu )
B, methods
1. Form Control
Move to a form
Window.moveby (x, y)-moves the specified pixel along the x\y axis relative to the current position, as negative numbers are in the opposite direction
Window.moveto (x, y)--moves to the specified pixel along the x\y axis relative to the upper-left corner of the browser, as negative numbers are in the opposite direction
Changes in form size
Resizeby (x, y)--Adjusts the width and height relative to the size of the current form
Resizeto (x, y)--Adjusts the form to the specified width and height
2. Control of the form scroll bar
Scrollby (x, y)-the pixels moved relative to the position of the current scroll bar (if there is a scroll bar)
ScrollTo (x, y)--moves to the specified pixel relative to the height or width of the current window
3. Function of time interval
SetInterval (A, B)-invokes a function or evaluates an expression by a specified period (in milliseconds)
Clearinterval (t)--cancels timeout set by SetInterval ()
SetTimeout (A, B)-invokes a function or evaluates an expression after a specified number of milliseconds and executes only once
Cleartimeout (t)--cancels timeout set by the SetTimeout () method
//format ExamplesSetInterval (' Alert (1) ', 1000);---------------------------varA=0;functionChen () {alert (a); A++;}; SetInterval (Chen,1000);-----------------------varA=0;functionChen () {alert (a); A++;}; SetInterval (' Chen () ', 1000);----------------------varA=0; SetInterval (function() {alert (a); A++;},1000);
// scroll bar Auto Scroll, click Page Stop window.onload=function() { var t=setinterval (function() { Window.scrollby (0,100); }; Document.body.onclick=function() { clearinterval (t);} }
4. Open a new window
window.open (url,name,features,replace)--Open a new browser window or find a named window
URL: An optional string that declares the URL of the document to display in a new window. If this argument is omitted, or if its value is an empty string, then the new window will not display any documents
Name: An optional string that is a comma-delimited list of features, including numbers, letters, and underscores, which declares the name of the new window
Features: An optional string that declares the characteristics of the standard browser to be displayed for the new window. If this argument is omitted, the new window will have all standard features
Replace: An optional Boolean value. Specifies whether the URL loaded into the window creates a new entry in the window's browsing history, or replaces the current entry in the browsing history
JavaScript Learning Notes Collation (Window object)