<body> <table id="t1" align="center" border="1" width="30%"> <tr> <th>Emp ID</th> <th>Emp Name</th> </tr> <tr> <td>1001</td> <td>Santi Cazorla</td> </tr> <tr> <td>1002</td> <td>Thomas Vermaelen</td> </tr> <tr> <td>1003</td> <td>Nacho Monreal</td> </tr> <tr> <td align="center" colspan="2"><input type="button" id="b1" value="Press" onclick="createCaption()"> </td> </tr> </table> </body>
function createCaption() { var c=document.getElementById("t1").createCaption(); c.innerHTML="EmployeeInfo"; }
caption { font-family:comic sans ms; color:green; } <style>