3wschool TIY
(请在下面的文本框中编辑您的代码,然后单击此按钮测试结果。)
编辑您的代码:
<html> <head> <script type="text/javascript"> function changeColSpan() { document.getElementById("td1").colSpan="2"; } </script> </head> <body> <table border="1"> <tr> <th>名</th> <th>姓</th> </tr> <tr> <td id="td1">John</td> <td id="td2">Adams</td> </tr> </table> <br /> <input type="button" onclick=changeColSpan() value="改变 colspan" /> </body> </html>
查看结果: