Latest web development tutorials

Metoda HTML DOM getAttributeNode ()

Elementy obiektu obiekt elementu

Przykłady

Powrót atrybutu target link:

document.getElementsByTagName("a")[0].getAttributeNode("target");

Spróbuj »

Definicja i Wykorzystanie

Metoda getAttributeNode (), aby uzyskać węzeł atrybutu po nazwie od bieżącego elementu.

Wskazówka: Jeśli chcesz tylko do zwracania wartości nieruchomości, należy getAttribute metody.


Pomoc Browser

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Metoda Wszystkie główne przeglądarki obsługują getAttributeNode ()


gramatyka

element.getAttributeNode( attributename )

parametry

参数 类型 描述
attributename String 必须。你想返回的属性名。

Wartość zwracana

类型 描述
Attr object 指定的属性节点

dane techniczne

wersja DOM Poziom podstawowy 1 Element obiektu


Elementy obiektu obiekt elementu