HTML DOM基本对象
Document| Property | Description | W3C |
|---|
| anchors | Returns a collection of all the anchors in the document | Yes |
| applets | Returns a collection of all the applets in the document | Yes |
| body | Returns the body element of the document | Yes |
| cookie | Returns all name/value pairs of cookies in the document | Yes |
| documentMode | Returns the mode used by the browser to render the document | No |
| domain | Returns the domain name of the server that loaded the document | Yes |
| forms | Returns a collection of all the forms in the document | Yes |
| images | Returns a collection of all the images in the document | Yes |
| lastModified | Returns the date and time the document was last modified | No |
| links | Returns a collection of all the links in the document | Yes |
| readyState | Returns the (loading) status of the document | No |
| referrer | Returns the URL of the document that loaded the current document | Yes |
| title | Sets or returns the title of the document | Yes |
| URL | Returns the full URL of the document | Yes
|
| Method | Description | W3C |
|---|
| close() | Closes the output stream previously opened with document.open() | Yes |
| getElementsByName() | Accesses all elements with a specified name | Yes |
| open() | Opens an output stream to collect the output from document.write() or document.writeln() | Yes |
| write() | Writes HTML expressions or JavaScript code to a document | Yes |
| writeln() | Same as write(), but adds a newline character after each statement | Yes |
Mouse Events| Event | Attribute | Description | DOM |
|---|
| click | onclick | The event occurs when the user clicks on an element | 2 |
| dblclick | ondblclick | The event occurs when the user double-clicks on an element | 2 |
| mousedown | onmousedown | The event occurs when a user presses a mouse button over an element | 2 |
| mousemove | onmousemove | The event occurs when a user moves the mouse pointer over an element | 2 |
| mouseover | onmouseover | The event occurs when a user mouse over an element | 2 |
| mouseout | onmouseout | The event occurs when a user moves the mouse pointer out of an element | 2 |
| mouseup | onmouseup | The event occurs when a user releases a mouse button over an element | 2 |
Keyboard Events| Event | Attribute | Description | DOM |
|---|
| keydown | onkeydown | The event occurs when the user is pressing a key or holding down a key | 2 |
| keypress | onkeypress | The event occurs when the user is pressing a key or holding down a key | 2 |
| keyup | onkeyup | The event occurs when a keyboard key is released | 2 |
Frame/Object Events| Event | Attribute | Description | DOM |
|---|
| abort | onabort | The event occurs when an image is stopped from loading before completely loaded (for | 2 |
| error | onerror | The event occurs when an image does not load properly (for |
|
| load | onload | The event occurs when a document, frameset, or | 2 |
| resize | onresize | The event occurs when a document view is resized | 2 |
| scroll | onscroll | The event occurs when a document view is scrolled | 2 |
| unload | onunload | The event occurs when a document is removed from a window or frame (for and | 2 |
Form EventsEvent Object| Constant | Description | DOM |
|---|
| AT_TARGET | The current event is in the target phase, i.e. it is being evaluated at the event target (1) | 2 |
| BUBBLING_PHASE | The current event phase is the bubbling phase (2) | 2 |
| CAPTURING_PHASE | The current event phase is the capture phase (3) | 2 |
| Property | Description | DOM |
|---|
| bubbles | Returns whether or not an event is a bubbling event | 2 |
| cancelable | Returns whether or not an event can have its default action prevented | 2 |
| currentTarget | Returns the element whose event listeners triggered the event | 2 |
| eventPhase | Returns which phase of the event flow is currently being evaluated | 2 |
| target | Returns the element that triggered the event | 2 |
| timeStamp | Returns the time (in milliseconds relative to the epoch) at which the event was created | 2 |
| type | Returns the name of the event | 2 |
| Method | Description | DOM |
|---|
| initEvent() | Specifies the event type, whether or not the event can bubble, whether or not the event's default action can be prevented | 2 |
| preventDefault() | To cancel the event if it is cancelable, meaning that any default action normally taken by the implementation as a result of the event will not occur | 2 |
| stopPropagation() | To prevent further propagation of an event during event flow | 2 |
EventTarget Object| Method | Description | DOM |
|---|
| addEventListener() | Allows the registration of event listeners on the event target (IE8 = attachEvent()) | 2 |
| dispatchEvent() | Allows to send the event to the subscribed event listeners (IE8 = fireEvent()) | 2 |
| removeEventListener() | Allows the removal of event listeners on the event target (IE8 = detachEvent()) | 2 |
EventListener Object| Method | Description | DOM |
|---|
| handleEvent() | Called whenever an event occurs of the event type for which the EventListener interface was registered | 2 |
DocumentEvent Object| Method | Description | DOM |
|---|
| createEvent() |
| 2 |
MouseEvent/KeyboardEvent Object| Property | Description | DOM |
|---|
| altKey | Returns whether or not the "ALT" key was pressed when an event was triggered | 2 |
| button | Returns which mouse button was clicked when an event was triggered | 2 |
| clientX | Returns the horizontal coordinate of the mouse pointer, relative to the current window, when an event was triggered | 2 |
| clientY | Returns the vertical coordinate of the mouse pointer, relative to the current window, when an event was triggered | 2 |
| ctrlKey | Returns whether or not the "CTRL" key was pressed when an event was triggered | 2 |
| keyIdentifier | Returns the identifier of a key | 3 |
| keyLocation | Returns the location of the key on the advice | 3 |
| metaKey | Returns whether or not the "meta" key was pressed when an event was triggered | 2 |
| relatedTarget | Returns the element related to the element that triggered the event | 2 |
| screenX | Returns the horizontal coordinate of the mouse pointer, relative to the screen, when an event was triggered | 2 |
| screenY | Returns the vertical coordinate of the mouse pointer, relative to the screen, when an event was triggered | 2 |
| shiftKey | Returns whether or not the "SHIFT" key was pressed when an event was triggered | 2 |
| Method | Description | W3C |
|---|
| initMouseEvent() | Initializes the value of a MouseEvent object | 2 |
| initKeyboardEvent() | Initializes the value of a KeyboardEvent object | 3 |
HTMLElement| Property | Description | W3C |
|---|
| accessKey | Sets or returns an accesskey for an element | Yes |
| className | Sets or returns the class attribute of an element | Yes |
| clientHeight | Returns the viewable height of the content on a page (not including borders, margins, or scrollbars) | No |
| clientWidth | Returns the viewable width of the content on a page (not including borders, margins, or scrollbars) | No |
| dir | Sets or returns the text direction of an element | Yes |
| id | Sets or returns the id of an element | Yes |
| innerHTML | Sets or returns the HTML contents (+text) of an element | Yes |
| lang | Sets or returns the language code for an element | Yes |
| offsetHeight | Returns the height of an element, including borders and padding if any, but not margins | No |
| offsetLeft | Returns the horizontal offset position of the current element relative to its offset container | No |
| offsetParent | Returns the offset container of an element | No |
| offsetTop | Returns the vertical offset position of the current element relative to its offset container | No |
| offsetWidth | Returns the width of an element, including borders and padding if any, but not margins | No |
| scrollHeight | Returns the entire height of an element (including areas hidden with scrollbars) | No |
| scrollLeft | Returns the distance between the actual left edge of an element and its left edge currently in view | No |
| scrollTop | Returns the distance between the actual top edge of an element and its top edge currently in view | No |
| scrollWidth | Returns the entire width of an element (including areas hidden with scrollbars) | No |
| style | Sets or returns the style attribute of an element | Yes |
| tabIndex | Sets or returns the tab order of an element | Yes |
| title | Sets or returns the title attribute of an element | Yes |
| Method | Description | W3C |
|---|
| toString() | Converts an element to a string | Yes |
阅读(1260) | 评论(0) | 转发(0) |