'getElementsByTagName()' Example : getElementsByTagName « Node Operation « JavaScript DHTML






'getElementsByTagName()' Example

    
<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>

    
      
      








Related examples in the same category