<html> <head> </head> <body> <html> <head> <script> function addTitle(){ var x=document.getElementById('myTable').createCaption() x.innerHTML="<b>Ma table des capitales</b>" } </script> </head> <body> <table id="myTable" border="y1"> <tr> <td>A</td> <td>B</td> </tr> <tr> <td>Paris</td> <td>Londre</td> </tr> <tr> <td>Madrid</td> <td>Berlin</td> </tr> </table> <form> <input type="button" onclick="addTitle()" value="Ajouter un titre"> </form> </body> </html> </body> </html> |
Cet article Javascript: Ajouter un titre à une table est apparu en premier sur .