运行 ❯
获取您
自己的
网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 Spaces
<!DOCTYPE html> <html> <body> <h1>The DOMTokenList Object</h1> <h2>The keys() Method</h2> <p>The keys in the list are:</p> <p id="demo" class="c1 c2 c3"></p> <script> let list = document.getElementById("demo").classList; let text = ""; for (let x of list.keys()) { text += x + "<br>"; } document.getElementById("demo").innerHTML = text; </script> </body> </html>