编辑下面的代码:【加编码】
<html> <head> <script> function alignCell() { document.getElementById('td1').align="right"; } </script> </head> <body> <table border="1"> <tr> <th>Firstname</th> <th>Lastname</th> </tr> <tr> <td id="td1">Peter</td> <td id="td2">Griffin</td> </tr> </table> <br> <input type="button" onclick="alignCell()" value="Align cell"> </body> </html>
结果: 【此窗口】 帮助?
Try it Yourself - © 自强学堂