<html> <body> <script language="JavaScript"> function function1() { alert(document.all.tags("p").length); } </script> <p>This is a sample text.</p> <p>This is another sample text.</p> <p>This is another sample text.</p> <p>This is another sample text.</p> <p>This is another sample text.</p> <p>This is another sample text.</p> <p>This is another sample text.</p> <p>This is another sample text.</p> <p>This is another sample text.</p> <p>This is another sample text.</p> <p>This is another sample text.</p>
<input type="button" value="Number of p elements" onClick="function1();"> </body> </html>