<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
无标题文档 <script language=javascript1.2> /* *==================================================================================================================== */ //定义全局的表格行列值 var col = 5; var row = 2; //currRowIndex 选定行 var currRowIndex = 0; //表单域数组(这部分作废)----------------- var elementNames = new Array(col); var k = 0; for(k=0;k
"; startStr += "
"; colStr = createTrs(colNum,rowNum); endStr = "
"; //创建用来获取最后表格输出数据的隐藏域 var hiddens = CreateHiddens(colNum,action); endStr += hiddens; endStr += ""; //输出表格 //document.forms(0).elements("t").value = (startStr + colStr + endStr); document.write(startStr + colStr + endStr); } function CreateHiddens(cols,action) { var str = new String(""); var i=0; for(i=0;i
"; } str+="
"; //创建每行的所有单元格 colStr += ""; colStr += i+1; colStr +=""; for(j=1;j<=colNum;j++) { colStr += ""; colStr += dataArray[i*colNum+j-1]; colStr +=""; } colStr +=""; } return colStr; } //把某行转变为输入状态 function ChangeInput(objTR) { var str = new String(""); var i = 0; for(i=1;i
tmp2) { objTB.moveRow(j,i); } } } } function orderTb1(objTD,type) { var objTR =objTD.parentElement; var objTable = objTR.parentElement; var colIndex = objTD.cellIndex; orderTB(objTable,colIndex); } //在表格末尾增加一行 function InsertRow(tableId) { var objTable = document.getElementById(tableId); var col = objTable.cells.length/objTable.rows.length; var row = objTable.rows.length; var objRow = objTable.insertRow(); //增加行 var i = 0; //取得最大序号 var max1 = 1; for(i=1;i
parseFloat(objTable.rows[i+1].cells[0].innerText)) { tmpMax = parseFloat(objTable.rows[i].cells[0].innerText); } else { tmpMax = parseFloat(objTable.rows[i+1].cells[0].innerText); } if(tmpMax>=max1) max1= tmpMax; } for(i=1;i<=col;i++) { var objCell = objRow.insertCell(); objRow.cells[0].innerText = parseFloat(max1)+1; objCell.innerHTML = " "; objCell.onmouseover = Td_MouseOver_Handle; objCell.onmouseout = Td_MouseOut_Handle objRow.cells[0].onclick = TD_Click_Handle; objRow.cells[0].onmouseover = doNothing; objRow.cells[0].onmouseout = doNothing; } //为新增的行提供事件绑定支持 //objRow.attachEvent('ondblclick', dblClick_Handle); objRow.ondblclick = dblClick_Handle; objRow.onblur = click_Handle; } //删除最后1行 function DeleteRow(tableId) { var objTable = document.getElementById(tableId); if(objTable.rows.length==1) { alert("对不起,你不能删除表格头!!!"); return; } if(confirm("确定删除?")) { objTable.deleteRow(); } } //选定指定行 function SelectRow(objTD) { var objTR =objTD.parentElement; var objTable = objTR.parentElement; for(var i=1;i
<script language="javascript1.2"> CreateTable('specForm','1','sub.jsp','tableId',col,row); </script>
可编辑的 HTML JavaScript 表格控件 DataGrid 选择自 jordan119 的 Blog
最新推荐文章于 2024-11-13 17:27:29 发布