Document Object
The following table lists some common attributes of the document Object of BOM:
Genus |
Description |
AlinkColor |
The color of the activated link, as defined by <body alink = "color"> * |
BgColor |
The background color of the page, as defined by <body bgcolor = "color"> * |
FgColor |
The text color of the page, as defined by <body text = "color"> * |
LastModified |
The date of the last modification page, which is a string |
LinkColor |
The link color, as defined by <body link = "color"> * |
Referrer |
URL in the back position in the browser history |
Title |
<Title/> text displayed in the tag |
URL |
URL of the currently loaded page |
VlinkColor |
The color of the accessed link, as defined by <body vlink = "color"> * |
* These attributes are opposed because they reference the old HTML features in the <body/> tag. Replace them with style sheet scripts.
There are also many sets of document objects that provide access to each part of the loaded page. The following table lists these sets:
Integration |
Description |
Anchors |
Set of all anchors on the page |
Applets |
Set of all applets on the page |
Embeds |
Set of all embedded objects on the page (represented by the <embed/> label) |
Forms |
Set of all forms on the page |
Images |
Set of all images on the page |
Links |
Set of all links on the page |
Similar to the window. frame set, each set of document objects can be referenced by a number or name, that is, images can be accessed using document. images [0] or document. images ["image name.
Location object
The location object indicates the URL of the loading window. In addition, it can parse the URL.
Hash-- If the URL contains #, this method returns the content after the symbol (for example, http://www.somewhere.com/index#selection1's hashequals "# selection1 ").
Host-- Name of the server (for example, www.wrox.com ).
Hostname-- Usually equal to host, and sometimes the previous www is omitted.
Href-- The complete URL of the currently loaded page.
Pathname-- URLPart after the Host Name. For example, the pathnameof http://www.somewhere.com/pictures/index.htmis "/pictures/index.htm ".
Port-- The request port declared in the URL. By default, most URLs do not have port information, so this attribute is usually blank. The port attribute of a URL like http://www.somewhere.com: 8080/index.htm is 8080.
Protocol-- The protocol used in the URL, that is, the section before the double slash. For example, the protocol attribute in the http://www.somewhere.com is equal to http:, and the protocol attribute of the ftp://www.somewhere.com is equal to ftp :.
Search-- Question mark (?) in the URL where the GET request is executed (?) Is also called a query string. For example, http://www.somewhere.com/abc.htm? Term = the search attribute in javascript is equal? Term = javascript
You can useLocation. replace("Http://www.baidu.com") method.
Navigator object
DetectionBrowserThe version, supported MIME types, and installed plug-ins (plug-in ). This object contains two sub-objects: a plug-in object and a MIME-type object.
AppCodeName |
Code |
AppName |
Name |
AppVersion |
Version |
Language |
Language |
MimeType |
The supported MIME types are represented in arrays. |
Platform |
Compile the Machine Type of the browser |
Plugins |
Use an array to indicate the installed plug-ins |
UserAgent |
User Agent header |
Screen Object
The screen object containsScreenInformation, usually including the following attributes (however, many browsers add their own attributes ):
Height-- The screen height, in pixels.
Width-- The screen width, in pixels.
AvailHeight-- The height (in pixels) of the screen that can be used by the window, which is equal to the width of the taskbar. The height changes with the user's taskbar and does not change with the window, this includes the space required by operating system elements (such as the Windows toolbar.
AvailWidth-- The screen width (in pixels) that can be used by the window, which is equal to the height of the taskbar and changes with the user's taskbar.
ColorDepth-- The color depth of the user's screen, measured in the number of digits per pixel. It is actually the number of digits of the color. Most systems use 32-bit.
Determine the size of the new window. The availHeight and availWidth attributes are very useful. For example, you can use the following code to fill your screen:
MoveTo (0, 0 );
ResizeTo (screen. availWidth, screen, availHeight );