The Hackman at his computer

<style>
body {
  background-color: lightgrey;
  color: blue;
}

h1 {
  background-color: black;
  color: white;
  width:80%;
}
<style>
<script>
alert(document.documentElement.innerHTML);

var x;
x = document.getElementsByTagName("hr");
document.getElementById("demo2").innerHTML=x.length;

y = document.getElementsByTagName("hr");
document.getElementById("demo3").innerHTML =
"Number of breaks: " + y.length;
</script>

1
2
3


This demonstrates the use of the javascript length method.

The script finds the length, the number count, of an element

Finding HTML Elements Using document.documentElement

The count number can be used for further manipulation in other programs.

Return to Table of Contents