源代码 :
点击运行
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>开源教程(ossoft.cn)</title> <script> function alertType(){ alert(document.getElementById("myButton").type) } </script> </head> <body> <button id="myButton" type="button" onclick="alertType()">点我!</button> </body> </html>
运行结果