執行 ❯
建立您
自己的
網站
×
更改方向
儲存程式碼
更改主題,深色/淺色
前往 Spaces
<!DOCTYPE html> <html> <body> <h1>The DOMTokenList Object</h1> <h2>The length Property</h2> <p>The number of class tokens in "demo" are:</p> <p id="demo" class="c1 c2 c3"></p> <script> const list = document.getElementById("demo").classList; let number = list.length; document.getElementById("demo").innerHTML = number; </script> </body> </html>