HTML DOM name 属性

定义和用法

The name property sets or returns the name of a element.

语法

  1. linkObject.name=name

实例

The following example outputs the name of a link element:

  1. <html>
  2. <head>
  3. <link rel="stylesheet" type="text/css" name="stylesheet"
  4. id="style1" href="try_dom_link.css" />
  5.  
  6. <script type="text/javascript">
  7. function alertName()
  8. {
  9. alert(document.getElementById("style1").name);
  10. }
  11. </script>
  12. </head>
  13. <body>
  14.  
  15. <form>
  16. <input type="button" onclick="alertName()"
  17. value="Alert name attribute" />
  18. </form>
  19.  
  20. </body>
  21. </html>