JavaScript操作表格

时间:2014-01-01 08:38:25
【文件属性】:

文件名称:JavaScript操作表格

文件大小:210KB

文件格式:ZIP

更新时间:2014-01-01 08:38:25

JavaScript操作表格

var index; var imgURL; var curSelected; var curSelected; //添加行 function addRow() { var objTable = document.getElementById("tb2"); var count = objTable.rows[0].cells.length; //获取行的列数 var row = objTable.insertRow(objTable.rows.length); for (var i = 0; i < count; i++) { var newCell = row.insertCell(i); newCell.innerHTML = "你好"; } } //删除行 function deleteRow() { var objTable = document.getElementById("tb2"); var lastIndex = objTable.rows.length - 1; objTable.deleteRow(lastIndex); } //添加列 function addCol() { var objTable = document.getElementById("tb2"); var count = objTable.rows[0].cells.length; var rowscount = objTable.rows.length; //获取行数 for (var i = 0; i < rowscount; i++) { var cell = objTable.rows[i].insertCell(count); cell.innerHTML = "呵呵"; } } //删除列 function deleteCol() { var objTable = document.getElementById("tb2"); var count = objTable.rows[0].cells.length; var rowscount = objTable.rows.length; //表格行数 for (var i = 0; i < rowscount; i++) { var cell = objTable.rows[i].deleteCell(count - 1); } }


【文件预览】:
JavaScript
----JavaScript.suo(27KB)
----JavaScript()
--------testColor.aspx.cs(335B)
--------bin()
--------index.aspx.designer.cs(845B)
--------obj()
--------web.config(7KB)
--------test.aspx.designer.cs(505B)
--------JavaScript.csproj.user(1KB)
--------Properties()
--------App_Data()
--------Default.aspx(11KB)
--------testColor.aspx(872B)
--------Default.aspx.cs(334B)
--------Default.aspx.designer.cs(509B)
--------index.aspx.cs(331B)
--------index.aspx(518B)
--------test.aspx.cs(330B)
--------test.aspx(5KB)
--------Images()
--------Style()
--------testColor.aspx.designer.cs(849B)
--------JavaScript()
--------JavaScript.csproj(6KB)
----JavaScript.sln(920B)

网友评论