<html> <body> <script language="JavaScript"> function function1() { var m = document.getElementsByTagName("P"); alert(m.length); } </script> <input type="button" value="Get the number of p elements in this page" onClick="function1();"> </body> </html>