x
 
<!DOCTYPE html>
<html>
<body>
<h1>Element 对象</h1>
<h2>getAttributeNode() 方法</h2>
<p>学习更多有关 <a id="myAnchor" href="dom_obj_attributes.asp" target="_blank">Attr 对象</a> 知识。</p>
<p>点击按钮可显示上面链接的 target 属性节点的值。</p>
<button onclick="myFunction()">试一试</button>
<p id="demo"></p>
<script>
function myFunction() {
  const element = document.getElementById("myAnchor");
  let text = element.getAttributeNode("target").value;
  document.getElementById("demo").innerHTML = text;
}
</script>
</body>
</html>