Js 动态修改表格内容、对齐表格内的内容
Js 动态修改表格内容、对齐表格内的内容,主要是控制表格的TableRow对象属性,使其左对齐、右对齐、向上对齐等,大家可以根据代码进行扩展,例如学习添加向下对齐等。
<html> <head> <title>TableRow对象的属性</title> <script language="JavaScript"> function cellContent(){ var objRow = myTable.rows; var objCell = objRow[0].cells; objCell[0].innerText = "CGI"; objCell[1].innerText = "ASP"; } </script> </head> <body> <h2>TableRow对象的属性</h2> <hr> <table id="myTable" border=1> <tr> <td>HTML</td> <td>CSS</td> </tr> <tr> <td height="50">JavaScript</td> <td height="50">VBScript</td> </tr> </table> <form> <input type="button" onclick="cellContent()" value="单元格内容"> <input type="button" onclick="myTable.rows[0].align='right';" value="向右对齐"> <input type="button" onclick="myTable.rows[1].vAlign='top';" value="向上对齐"> </form> </body> </html>
相关推荐
移动开发与培训 2020-08-16
ReunionIsland 2020-08-16
88274956 2020-11-03
runner 2020-09-01
梦的天空 2020-08-25
lyqdanang 2020-08-16
MyNameIsXiaoLai 2020-07-08
星辰的笔记 2020-07-04
csstpeixun 2020-06-28
letheashura 2020-06-26
liaoxuewu 2020-06-26
sunzhihaofuture 2020-06-21
FEvivi 2020-06-16
坚持着执着 2020-06-16
waterv 2020-06-14
xiaoge00 2020-06-14
firejq 2020-06-14
firstboy0 2020-06-14
e度空间 2020-06-12
zhongweinan 2020-06-10