Useful to select all tags like input or select.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
<script> function getElements() { var x=document.getElementsByTagName("input"); alert(x.length); } </script> </head> <body> <input type="text" size="20"><br> <input type="text" size="20"><br> <input type="text" size="20"><br><br> <input type="button" onclick="getElements()" value="How many input elements?"> </body> |