<!DOCTYPE html>
<html>
<body>
<p>Hello World!</p>
<p>How many paragraphs in this document?</p>
<p>This example demonstrates the length property of a nodelist.</p>
<p id="demo"></p>
<script>
var myNodelist = document.getElementsByTagName("p");
document.getElementById("demo").innerHTML = myNodelist.length;
</script>
</body>
</html>