为什么这里不能通过getAttribute()方法获取nodeName属性值?
phpcn_u238
phpcn_u238 2016-12-23 09:39:51
0
1
848

为什么这里不能通过getAttribute()方法获取nodeName属性值?

phpcn_u238
phpcn_u238

répondre à tous(1)
Ty80

获得链接的 target 属性:

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

结果:

_blank

getAttribute() 方法返回指定属性名的属性值。

提示:如果您希望以 Attr 对象返回属性,请使用 getAttributeNode。


Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal
À propos de nous Clause de non-responsabilité Sitemap
Site Web PHP chinois:Formation PHP en ligne sur le bien-être public,Aidez les apprenants PHP à grandir rapidement!