function changeColSpan() { document.getElementById("td1").colSpan="2"; }
<table border="1"> <tbody> <tr> <th>名</th> <th>姓</th> </tr> <tr> <td id="td1">John</td> <td id="td2">Adams</td> </tr> </tbody> </table> <br> <input type="button" onclick="changeColSpan()" value="改变 colspan">