确定按钮的名称

  1. <html>
  2. <body>
  3.  
  4. <form>
  5. <input type="button" id="button1" name="button1" value="Click Me!" />
  6. </form>
  7.  
  8. <p>The name of the button is:
  9. <script type="text/javascript">
  10. x=document.getElementById('button1');
  11. document.write(x.name);
  12. </script></p>
  13.  
  14. </body>
  15. </html>