确定按钮的类型

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <script>
  5. function alertType()
  6. {
  7. alert(document.getElementById("myButton").type)
  8. }
  9. </script>
  10. </head>
  11. <body>
  12.  
  13. <button id="myButton" type="button" onclick="alertType()">点击这里</button>
  14.  
  15. </body>
  16. </html>