HTML DOM getAttributeNode() ·½·¨
ʵÀý
·µ»ØÁ´½ÓµÄ target ÊôÐÔ£º
document.getElementsByTagName("a")[0].getAttributeNode("target");
¶¨ÒåºÍÓ÷¨
getAttribute() ·½·¨·µ»ØÖ¸¶¨ÊôÐÔÃûµÄÊôÐÔÖµ£¬ÒÔ Attr ¶ÔÏó¡£
Ìáʾ£ºÈç¹ûÄúÖ»ÐèÒª·µ»ØÊôÐÔÖµ£¬ÇëʹÓà getAttribute¡£
ä¯ÀÀÆ÷Ö§³Ö
| IE | Firefox | Chrome | Safari | Opera |
|---|---|---|---|---|
ËùÓÐÖ÷Á÷ä¯ÀÀÆ÷¾ùÖ§³Ö getAttributeNode() ·½·¨¡£
Óï·¨
element.getAttributeNode(attributename)
²ÎÊý
| ²ÎÊý | ÀàÐÍ | ÃèÊö |
|---|---|---|
| attributename | String | ±ØÐè¡£ÐèÒª·µ»ØµÄÊôÐÔµÄÃû³Æ¡£ |
·µ»ØÖµ
| ÀàÐÍ | ÃèÊö |
|---|---|
| Attr ¶ÔÏó | Ö¸¶¨µÄÊôÐÔ½Úµã |
¼¼Êõϸ½Ú
| DOM °æ±¾ | Core Level 1 Element Object |