源代碼
點擊運行
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>教程</title> </head> <body> <button id="button1" name="button1">點我!</button> <p>按鈕的名稱: <script> document.write(document.getElementById("button1").name); </script></p> </body> </html>
運行結果