本文實(shí)例講述了JS實(shí)現(xiàn)控制表格內(nèi)指定單元格內(nèi)容對(duì)齊的方法。分享給大家供大家參考。具體如下:
下面的代碼控制表格單元格的內(nèi)容向右對(duì)齊
<!DOCTYPE html><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>希望本文所述對(duì)大家的javascript程序設(shè)計(jì)有所幫助。
新聞熱點(diǎn)
疑難解答
圖片精選
網(wǎng)友關(guān)注