菜单切换
FACESOHO知行者
心灵
记录
远方
赞赏工具
源代码:
点击运行
保存
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>小鸟启蒙(facesoho.com)</title> <script> function displayResult(){ var table=document.getElementById("myTable"); alert(table.rows[0].cells[0].abbr); } </script> </head> <body> <table id="myTable" border="1"> <tr> <td abbr="def">保持名称简短的缩写,浏览器可能重复显示它们。</td> <td>单元格数据</td> </tr> <tr> <td>单元格数据</td> <td>单元格数据</td> </tr> </table> <br> <button type="button" onclick="displayResult()">获取第一个单元格的缩写</button> </body> </html>
运行结果