1. BOM programming 1.1. Fundamentals of BOM Programming
The full name Browser object model, the browser objects.
JavaScript is a JavaScript script interpreter that is built into the browser to execute the JavaScript scripting language.
In order to facilitate the operation of the browser, JavaScript encapsulates the browser's various objects so that developers can easily manipulate the browser.
1.2. BOM object: 1.3. Window object
The Window object is the top-level object in the JavaScript hierarchy.
The Window object represents a browser window or a frame.
The Window object is automatically created each time <body> or <frameset> appears.
1.3.1. Methods in Window
Document read-only reference to document object
Location object for a window or frame
History's read-only reference to the History object.
Document.tilte setting the title of a page
MoveTo () Moves the screen position in the upper-left corner of the window to the specified x and y positions.
Moveby () moves relative to the current position.
Resizeto () Adjusts the window of the current browser.
Open () Opens a new window to display the specified URL (in some browsers a new tab is hit)
SetTimeout (Vcode, imilliseconds) executes the code after a timeout.
SetInterval (Vcode, imilliseconds) executes the code on a timed basis, and the first time is first and then executed.
2. Event a) Description of event
The event properties can be specified in virtually all HTML elements.
Each element supports what events should be queried for the document.
All event properties start with on, followed by the way events are triggered, such as:
OnClick, which means click
OnKeyDown, indicating that the key is pressed
...
b) Common types of events:
Mouse click Related:
The onclick is triggered when the user clicks the object with the left mouse button.
OnDblClick is triggered when the user double-clicks an object.
OnMouseDown is triggered when the user clicks on an object with any mouse button.
OnMouseUp triggers when the user releases the mouse button while the mouse is over the object.
Mouse movement Related:
onmouseout fires when the user moves the mouse pointer out of the bounds of the object.
OnMouseMove triggers when the user moves the mouse over an object.
Focus-Related:
Onblur fires when an object loses input focus.
onfocus triggers when the object gets focus.
Other:
OnChange is triggered when the contents of an object or selection change.
OnLoad fires immediately after the browser finishes loading the object.
OnSubmit triggered when the form is about to be committed.
Location Object
The Location object is created automatically by the JavaScript runtime engine and contains information about the current URL.
Important Methods in Location:
The HREF property sets or gets the entire URL as a string.
Reload () re-loading the current page
1.3.2. Screen Object
The Screen object is created automatically by the JavaScript runtime engine and contains information about the client display screens.
Property:
Availheight Gets the work area height of the system screen, excluding the Microsoft Windows taskbar.
Availwidth gets the width of the work area of the system screen, excluding the Windows taskbar.
Height gets the vertical resolution of the screen.
Width gets the horizontal resolution of the screen.
Example:
document.write ("Screen work area:" + Screen.availheight + "," + Screen.availwidth + "<br>");
document.write ("Screen resolution:" + Screen.height + "," + Screen.width + "<br>");
1.3.3. Document Object
This object represents the entire document page
The collection of objects:
All get page All element object
Forms get all Form objects for a page
Images get all Picture objects on the page
Links get all hyperlinks or area objects
JavaScript Learning Summary-bom Programming-(VI)