<!DOCTYPE html> <html> <body> <h1>Document 对象</h1> <h2>getElementsByTagName() 方法</h2> <p>本文档中的 applet 数量为:</p> <p id="demo"></p> <script> let num = document.getElementsByTagName("applet").length; document.getElementById("demo").innerHTML = num; </script> </body> </html>