您的位置:首页 > 移动开发 > Objective-C

HTML DOM HTMLElement Object

2011-07-17 21:31 363 查看

HTMLElement Object

The following collections, properties, and methods can be used on all HTML elements.

HTMLElement Collections

W3C: W3C Standard.
CollectionDescriptionW3C
attributes[]Returns an array of the attributes of an elementYes
childNodes[]Returns an array of child nodes for an elementYes

HTMLElement Properties

PropertyDescriptionW3C
accessKeySets or returns an accesskey for an elementYes
classNameSets or returns the class attribute of an elementYes
clientHeightReturns the viewable height of the content on a page (not including borders, margins, or scrollbars)Yes
clientWidthReturns the viewable width of the content on a page (not including borders, margins, or scrollbars)Yes
dirSets or returns the text direction of an elementYes
disabledSets or returns whether an element is disabled, or notYes
firstChildReturns the first child of an elementYes
heightSets or returns the height attribute of an elementYes
idSets or returns the id of an elementYes
innerHTMLSets or returns the HTML contents (+text) of an elementYes
langSets or returns the language code for an elementYes
lastChildReturns the last child of an elementYes
lengthYes
nextSiblingReturns the element immediately following an elementYes
nodeNameReturns the tagname of an element (in uppercase)Yes
nodeTypeReturns the type of the elementYes
nodeValueReturns the value of the elementYes
offsetHeightReturns the height of an element, including borders and padding if any, but not marginsNo
offsetLeftReturns the horizontal offset position of the current element relative to its offset containerYes
offsetParentReturns the offset container of an elementYes
offsetTopReturns the vertical offset position of the current element relative to its offset containerYes
offsetWidthReturns the width of an element, including borders and padding if any, but not marginsNo
ownerDocumentReturns the root element (document object) for an elementYes
parentNodeReturns the parent node of an elementYes
previousSiblingReturns the element immediately before an elementYes
scrollHeightReturns the entire height of an element (including areas hidden with scrollbars)Yes
scrollLeftReturns the distance between the actual left edge of an element and its left edge currently in viewYes
scrollTopReturns the distance between the actual top edge of an element and its top edge currently in viewYes
scrollWidthReturns the entire width of an element (including areas hidden with scrollbars)Yes
styleSets or returns the style attribute of an elementYes
tabIndexSets or returns the tab order of an elementYes
tagNameReturns the tagname of an element as a string (in uppercase)Yes
titleSets or returns the title attribute of an elementYes
widthSets or returns the width attribute of an elementYes

HTMLElement Methods

MethodDescriptionW3C
appendChild()Adds a new child element to the end of the list of children of the elementYes
blur()Removes focus from an elementYes
click()Executes a click on an elementYes
cloneNode()Clones an elementYes
focus()Gives focus to an elementYes
getAttribute()Returns the value of an attributeYes
getElementsByTagName()Accesses all elements with a specified tagnameYes
hasChildNodes()Returns whether an element has any child elementsYes
insertBefore()Inserts a new child element before an existing child elementYes
item()Returns an element based on its index within the document treeYes
normalize()Puts all text nodes underneath this element (including attributes) into a "normal" form where only structure (e.g., elements, comments, processing instructions, CDATA sections, and entity references) separates Text nodes, i.e., there are neither adjacent Text nodes nor empty Text nodesYes
removeAttribute()Removes a specified attribute from an elementYes
removeChild()Removes a child elementYes
replaceChild()Replace a child elementYes
setAttribute()Adds a new attribute to an elementYes
toString()Converts an element to a stringYes
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: