Javascript: Obtenir le nombre de point d’ancrage d’une page

Author:

Javascript: Obtenir le nombre de point d'ancrage d'une page
Download

<html>
  <head>
 
  </head>
  <body>
    <HTML>
<HEAD>
<TITLE>Ancrage document.anchors</TITLE>
<SCRIPT LANGUAGE="JavaScript">
function suivantAnchor(where) {
    window.location.hash = where
}
</SCRIPT>
</head>
<body>
<a name="haut"><h1>Haut</h1></a>
<form>
<input type="button" name="suivant" value="suivant" 
    onclick="suivantAnchor('section1')">
</form>
 
<hr />
<a name="section1"><h1>section 1</h1></a>
<form>
<input type="button" name="suivant" value="suivant" 
    onclick="suivantAnchor('section2')">
</form>
<hr />
<a name="section2"><h1>section 2</h1></a>
<form>
<input type="button" name="suivant" value="suivant" 
    onclick="suivantAnchor('section3')">
</form>
<hr />
<a name="section3"><h1>section 3</h1></a>
<form>
<input type="button" name="suivant" value="back to top" 
    onclick="suivantAnchor('haut')">
</form>
<hr /><p>
<script>
document.write("Nombre d'ancrage: " + document.anchors.length)
</script>
</body>
</html>
  </body>
</html>

Cet article Javascript: Obtenir le nombre de point d’ancrage d’une page est apparu en premier sur .