Objek ng HTMLElement ng XML DOM
- Nakaraang Pahina DOM HTMLDocument
- Susunod na Pahina DOM NamedNodeMap
Ang HTMLElement objekto ay naglalarawan ng isang elemento sa HTML.
Ang katangian ng HTMLElement objekto
Ang lahat ng katangian ng HTMLElement objekto, na kasama ang lahat ng katangian na suportado ng lahat ng HTML tag. Ang iba pang katangian, ay partikular sa isang tiyak na HTML tag. Inaabot ng HTMLElement objekto ang Node and Element Ang pangkaraniwang katangian ng objekto, na nagpatupad din ng ilang hindi estandar na katangian na inilarawan sa ibaba:
- className
-
Tinuturing ang class attribute ng elemento. Pansin: ang pangalan ng katangian na ito ay hindi "class", dahil "class" ay isang reserved word sa JavaScript.
Type: String. Status: writable.
- currentStyle
-
Ang katangian na ito na partikular sa IE ay naaangkop sa grupo ng kaskaduhan ng lahat ng CSS attribute ng elemento. Ito ay isang alternatibo sa Window.getComputedStyle() na partikular sa IE.
Type: String. Status: writable.
- dir
-
Tinuturing ang dir attribute ng elemento, na nagpahayag ng direksyon ng teksto ng dokumento.
Type: String. Status: writable.
- id
-
Tinuturing ang id attribute ng elemento. Wala ng dalawang elemento na may magkakaparehong id value sa isang dokumento.
Type: String. Status: writable.
- innerHTML
-
Tinuturing ang string na nasa loob ng elemento, hindi kasama ang simula at wakas na marka ng elemento. Kapag hinahanap ang katangian na ito, magiging HTML text string ang nilalaman ng elemento. Kapag itinakda ang katangian na ito bilang HTML text string, maaaring paliwanagin ang nilalaman ng elemento gamit ang paglalagay ng HTML na representation. Hindi maaaring itakda ang katangian na ito kapag inilaladang ang dokumento. Ito ay isang hindi estandar na katangian na mula sa IE4, na nakatanggap ng suporta mula sa lahat ng modernong browser.
Type: String. Status: writable.
- lang
-
Tinuturing ang lang attribute ng elemento, na nagpahayag ng code ng wika ng nilalaman ng elemento.
Type: String. Status: writable.
- offsetHeight, offsetWidth
-
返回元素的高度和宽度,以像素为单位。这是非标准的但却得到很好支持的属性。
scrollHeight, scrollWidth
- offsetHeight, offsetWidth
-
Returns the height and width of the element in pixels. This is a non-standard but well-supported property.
scrollHeight, scrollWidth
- offsetLeft
-
Returns the offset from the left boundary of the current element to the left boundary of its containing element in pixels.
scrollHeight, scrollWidth
- offsetTop
-
Returns the offset from the top boundary of the current element to the top boundary of its containing element in pixels.
Type:Node. Status: read-only.
- offsetParent
-
Returns a reference to the nearest dynamically positioned containing element, with all offsets determined relative to that element. If the element's style.display is set to none, this property returns null. This is a non-standard but well-supported property.
scrollHeight, scrollWidth
- Type: int. Status: read-only. Returns the complete height and width of the element in pixels. When an element has a scrollbar (such as due to the CSS overflow property), these properties are different from offsetHeight and offsetWidth, as offsetHeight and offsetWidth only report the size of the visible part of the element. This is a non-standard but well-supported property.
-
scrollTop, scrollLeft
Type: int. Status: writable. Sets or returns the number of pixels scrolled to the left or top edge of the element. These pixels are useful only when the element has a scrollbar, for example, when the element's CSS overflow property is set to auto. These properties are also defined on the <body> or <html> tags of the document (this depends on the browser), and together they determine the position of the scrolling document. Note that these properties do not specify the scroll amount of an <iframe> tag. This is a non-standard but well-supported property.
- style
-
Returns the value of the style attribute set for the current element's inline CSS style. Note that the value of this attribute is not a string.
Type:CSS2Properties. Status: read-only.
- title
-
Specifies the title attribute of the element. When the mouse hovers over the element, many browsers display the value of this attribute in the element's 'tool tip'.
Type: String. Status: writable.
The methods of HTMLElement object
The HTMLElement object inherits Node and Element The standard methods of the object. Certain types of elements implement methods specific to the tag, CodeW3C.com at Manwal ng HTML DOMThe reference pages for each tag provide information about these methods.
Most modern browsers also implement the following non-standard methods:
Metodo | Paglalarawan |
---|---|
scrollIntoView() | Iscroll ang dokumento. Huhubad ang elemento sa itaas o sa ibaba ng window. |
Handler ng Evento ng HTMLElement Obheheto
Ang lahat ng HTML element na responsibo sa mga event ng mouse at keyboard ay maaaring itakbo ang mga handler ng event na nakalista dito. Ang ilang elementong tulad ng link at button ay magsasagawa ng default na operasyon kapag nangyayari ang mga event. Para sa mga ganoong elementong ito, mas maraming detalye ay maaaring matagpuan saPahina ng Pagsasalaysay ng Espesyal na Elementodito.
Mangyaring basahin Manwal ng Atributo ng Evento ng HTML, upang makakuha ng mas maraming impormasyon tungkol sa handler ng HTML event.
Paano makakuha ng mas detalyadong impormasyon tungkol sa HTMLElement Obheheto
Sa Manwal ng HTML DOM ng CodeW3C.com, gumawa kami ng espesyal na pahina ng pagkilala para sa DOM Obheheto na tumutugma sa marka ng HTML:
Mga Kaugnay na Pahina
Manwal ng XML DOM:Obheheto ng Document
Manwal ng XML DOM:getElementById() ng Document
Manwal ng XML DOM:getElementsByTagName() ng Document
- Nakaraang Pahina DOM HTMLDocument
- Susunod na Pahina DOM NamedNodeMap