• 회원가입
  • 로그인

[DOM_Document] JS - links 속성 - href 속성 갖은 (앵커태그 + 에어리어태그) 링크태그집합

document.links 예제

 

<img src ="aaa.gif" width="100" height="100" alt="aaa" usemap ="#hzmap">


<map name="hzmap">

  <area shape="rect"   coords="204,3,259,20" href="aaa.htm" alt="aaa">

  <area shape="circle" coords="269,2,323,20" href="bbb.htm" alt="bbb">

</map>


<ul>

  <li><a href="https://homzzang.com/b/html">HTML</a></li>

  <li><a href="https://homzzang.com/b/css">CSS</a></li>

</ul>


<button onclick="homzzang()">클릭</button>


<p id="demo"></p>


<script>

function homzzang() {

  var x = document.links.length;

  document.getElementById("demo").innerHTML = x;

}

</script>

 

결과보기

결과값: 4

 

방문 감사합니다. (즐겨찾기 등록: Ctrl + D)

찾아주셔서 감사합니다. Since 2012