![]() ![]() ![]() ![]() |
|||||
|
|||||
樓主 Robert ![]()
![]() |
我的程式碼如下,請問要如何讓整個表格置中? <HTML> <HEAD><TITLE>第六章練習</TITLE></HEAD> <style> table{ border:2px solid; border-collapse:collapse; } th{ border:2px solid; background-color:#FFAA33; } caption{ background: #dbb768; font-weight: bold; font-size: 1.1em; } </style> <BODY> <script type ="text/javascript"> { var body = document.getElementsByTagName("body")[0]; var tbl = document.createElement("table"); var tblbody = document.createElement("tbody"); var caption= "<caption>成績單</caption>"; var row = document.createElement("tr"); var header = document.createElement("th"); var cellText = document.createTextNode("成績"); header.appendChild(cellText); row.appendChild(header); cellText = document.createTextNode("層級"); header = document.createElement("th"); header.appendChild(cellText); row.appendChild(header); tblbody.appendChild(row); tbl.innerHTML=caption; tbl.appendChild(tblbody); body.appendChild(tbl); } </BODY> </HTML>
搜尋相關Tags的文章:
[ 表格置中 ] ,
本篇文章發表於2020-01-06 16:58 |