首页
极刻
圈子
教程
开源
登录 / 注册
返回教程:Javascript 参考手册
TRY RUN / 在线示例
Javascript 参考手册 尝试一下
Javascript 参考手册 尝试一下
源代码
运行
<!DOCTYPE html> <html> <head> <script> function displayResult() { alert(document.getElementById("myTable").caption.innerHTML); } </script> </head> <body> <table id="myTable" border="1"> <caption>This is a table caption</caption> <tr> <td>cell 1</td> <td>cell 2</td> </tr> <tr> <td>cell 3</td> <td>cell 4</td> </tr> </table> <br> <button type="button" onclick="displayResult()">Show text in table caption</button> </body> </html>
运行结果