Tryit Editor v1.8

Source Code:
<!DOCTYPE html> <html> <head> <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> </html>
Result:
W3Schools.com - Try it yourself