JavaScript获取网上指定id的按钮的名字(name),按钮包含了name属性,可以直接获取
<!DOCTYPE html> <html> <body> <button id="button1" name="button1">Click Me!</button> <p>The name of the button is: <script> document.write(document.getElementById("button1").name); </script></p> </body> </html>