//调用界面///////////////////////////////////////////
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script language="javascript1.2" src="../../js/DatGrid.js"></script>
<script language="javascript1.2" src="../../js/setdate.js"></script>
</head>
<body>
<input type="button" onClick="InsertRow('tableId');" value="插入行">
<input type="button" onClick="DeleteRow('tableId');" value="删除尾行">
<input type="button" onClick="getData('tableId','specForm');" value="保存数据">
<input type="button" onClick="DeleteOneRow('tableId',currRowIndex)" value="删除指定行">
<input type="button" onClick="orderTB(document.getElementById('tableId'),3);" value="对指定列排序">
<script language="javascript1.2">
InitColRow(3,4); //初始化表格行列
//==========================================所有初始化数据=========================================
var head = new Array(col); //标题头数组
for(var i=0;i<head.length;i++)
head[i] = 1;
var colPropertys = new Array(col) //初始化行列读些属性
for(var i=0;i<colPropertys.length;i++)
colPropertys[i] = 1;
var colDefValues = new Array(col) //初始化列将要装入的默认值
for(var i=0;i<colDefValues.length;i++)
colDefValues[i] = "";
var dArray = new Array(col*row); //装入修改时需要用的修改前的数据
var m=0,n=0;
for(m=0;m<row;m++)//行
{
for(n=0;n<col;n++)//列
{
dArray[m*col + n] ="" + m + "," + n + ""; //注意这里代表2维数组
}
}
var colOpMode = new Array(col); //列操作方式设置
colOpMode[1] = "http://localhost:8000/TaxWeb/AgreementCtrlAction.do?action=6";
colOpMode[3] = "No.do";
colOpMode[0] = "date";
//=================================================================================================
//初始化表格数据
init(head,colPropertys,colDefValues,dArray,colOpMode);
//创建表格
CreateTable('specForm','1','sub.jsp','tableId',col,row);
</script>
</body>
</html>
关键词:可编辑的 HTML JavaScript 表格控件 DataGrid II