HTML DOM abbr 属性

定义和用法

abbr 属性可设置或返回表元中内容的缩写版本(针对非可视的媒介,比如语音和盲文)。

语法

  1. tabledataObject.abbr=text

实例

下面的例子可提示某个单元格的 abbr:

  1. <html>
  2. <head>
  3. <script type="text/javascript">
  4. function alertAbbr()
  5. {
  6. alert(document.getElementById('td1').abbr);
  7. }
  8. </script>
  9. </head>
  10. <body>
  11.  
  12. <table border="1">
  13. <tr>
  14. <th>Firstname</th>
  15. <th>Lastname</th>
  16. </tr>
  17. <tr>
  18. <td id="td1" abbr="Some text">Peter</td>
  19. <td id="td2">Griffin</td>
  20. </tr>
  21. </table>
  22. <br />
  23. <input type="button" onclick="alertAbbr()"
  24. value="Alert abbr" />
  25.  
  26. </body>
  27. </html>