编辑下面的代码:【加编码】
<html> <head> <script> function displayResult() { var c=document.getElementById("myCol"); alert("The horizontal offset of the ch property is: " + c.chOff); } </script> </head> <body> <table border="1"> <colgroup> <col> <col id="myCol" align="char" char="." charoff="2"> </colgroup> <tr> <th>Month</th> <th>Savings</th> </tr> <tr> <td>January</td> <td>$100.00</td> </tr> <tr> <td>February</td> <td>$10.00</td> </tr> </table> <br> <button type="button" onclick="displayResult()">Get horizontal offset of the alignment character</button> <p><b>Note:</b> The functionality of the charoff attribute is not implemented in any of the major browsers.</p> </body> </html>
结果: 【此窗口】 帮助?
Try it Yourself - © 自强学堂