<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="zh-CN" />
<meta name="Keywords" content="" />
<meta name="Description" content="" />
<title></title>
<style>
#tab {
border:1px solid #aaa;
border-collapse:collapse;
width:80%;
}
#tab th{
border:1px solid #aaaaaa;
background:#ECE9D8;
border-collapse:collapse;
padding:5px;
text-align:left;
}
#tab td{
border:1px solid #d8d8d8;
border-collapse:collapse;
padding:5px;
}
.txt{
border:1px solid #888;
background:#ECE9D8;
}
.checkBg{
border:1px solid #aaaaaa;
background:#ECE9D8;
}
.checkTxt{
border:1px solid #aaa;
background:##d8d8d8;
}
.button {
border:1px solid #888;margin:5px 0px;
width:80px;background:#ECE9D8;height:22px;line-height:22px;
}
</style>
<script language="javascript" type="text/javascript">
/*
author:kevin
email:kevin_218@163.com
msn:xiao-kevin@hotmail.com
website:http://www.bluekevin.com
*/
function $(id) {return document.getElementById(id);}
function $F(name){return document.getElementsByTagName(name);}
function add(){
var otr = document.getElementById("tab").insertRow(-1);
var checkTd=document.createElement("td");
checkTd.innerHTML = '<input type="checkbox" class="check" onclick="ccolor()" name="checkItem">';
var otd1 = document.createElement("td");
otd1.innerHTML = '<input type="text" class="txt" name="infoName_txt" id="infoName_txt'+($('tab').rows.length-1)+'" maxlength="30" value=""/>';
var otd2 = document.createElement("td");
otd2.innerHTML = '<input type="text" class="txt" name="infoValue_txt" id="infoValue_txt'+($('tab').rows.length-1)+'" maxlength="30" value=""/>';
otr.appendChild(checkTd);
otr.appendChild(otd1);
otr.appendChild(otd2);
}
function ccolor()
{
var c1 = document.getElementsByName('checkItem');
for(var i=0; i<c1.length; i++)
if(c1[i].checked)
{
c1[i].parentNode.parentNode.className="checkBg";
c1[i].parentNode.nextSibling.firstChild.className="checkTxt";
c1[i].parentNode.nextSibling.nextSibling.firstChild.className="checkTxt";
}
else { c1[i].parentNode.parentNode.className="";
c1[i].parentNode.nextSibling.firstChild.className="";
c1[i].parentNode.nextSibling.nextSibling.firstChild.className="";}
}
function del(){
var c = document.getElementsByName('checkItem');
var idArray = new Array();
for(var i=0; i<c.length; i++)
if(c[i].checked)
idArray.push(i);
var rowIndex;
var nextDiff =0;
for(j=0;j< idArray.length;j++)
{
rowIndex = idArray[j]+1-nextDiff++;
document.getElementById("tab").deleteRow(rowIndex);
}
}
function save(){
var postString = $("postString");
var checkboxs = document.getElementsByName("checkItem");
var ttab = document.getElementsByName("infoName_txt");
var tt2 = document.getElementsByName("infoValue_txt");
var idArray = new Array();
for(i=0;i<checkboxs.length;i++)
{
idArray.push(ttab[i].value + "|" + tt2[i].value);
}
postString.value = idArray.join("-");
alert(postString.value);
}
function alldell()
{
var des =document.getElementsByName('checkItem');
for(var i=0;i<des.length;i++)
{
if(des[i].checked=document.getElementById('delall').checked){
des[i].parentNode.parentNode.className="checkBg";
des[i].parentNode.nextSibling.firstChild.className="checkTxt";
des[i].parentNode.nextSibling.nextSibling.firstChild.className="checkTxt";}
else{ des[i].parentNode.parentNode.className="";
des[i].parentNode.nextSibling.firstChild.className="";
des[i].parentNode.nextSibling.nextSibling.firstChild.className="";}
}
}
</script>
</head>
<body>
<input name="addv_btn" id="addv_btn" type="button" class="button" onClick="add();" value="add" />
<input name="del_btn" id="del_btn" type="button" class="button" onClick="del();" value="del" />
<input name="save" id="save" type="button" class="button" onClick="save();" value="save" /><br>
<table id="tab" >
<tr>
<th width="5%"><input type="checkbox" id="delall" onclick="alldell()"></td>
<th width="40%">Name</td>
<th width="55%">value</td>
</tr>
</table>
<p>
<input type="text" name="postString" id="postString">
</p>
</body>
</html>
分享到:
相关推荐
3.动态添加节点/动态删除节点/动态移动节点 4.动态dom对象创建表格树 5.完美支持json格式数据,支持xml(需转换) 6.支持ajax加载节点 7.事件驱动 8.可以动态根据列内容排序 9.简化函数参数,利用{} object输入参数,风格...
最近在使用Bootstrap table ,有一个在某一列添加一个下拉列表,并且通过 “getAllSelections”方法获取所选行的需求,在实现这个功能的时,走了一些弯路,遇到了一些坑。所以今天总结出来,既是自己的学习,也分享...
9.9 JavaScript遍历table的行和列 9.10 表格按回车自动生成新行 9.11 单击单元格背景变色 9.12 单击表格某行后其他行隐藏 9.13 单击表头实现表格排序 9.14 单击单元格显示行的详细信息 9.15 表格设置为“100%”时...
9.9 JavaScript遍历table的行和列 9.10 表格按回车自动生成新行 9.11 单击单元格背景变色 9.12 单击表格某行后其他行隐藏 9.13 单击表头实现表格排序 9.14 单击单元格显示行的详细信息 9.15 表格设置为“100%”时...
最大优点是可以包含其他 SELECT 语句,使用能够动态地建立 WHERE 子句。 如 SELECT prod_id,prod_price,prod_name FROM Products WHERE vend_id IN(‘DELL’,’RBER’,’TTSR’); 八、单行函数: 函数一般在数据...
dynamicTable 完整的Ajax调用DOM的实例 第12章(/C12/) 12.1.htm 一个在元素内定义CSS的范例 12.2.htm 一个在Head元素内定义CSS的范例 12.3.htm 引用CSS文件的页面 12.4....
o 6.11 向MySQL增加新用户权限 o 6.12 怎样设置口令 o 6.13 存取拒绝(Access Denied)错误的原因 o 6.14 怎样使MySQL安全以对抗解密高手(cracker) * 7 MySQL 语言参考 o 7.1 文字:怎样写字符串和数字 + 7.1.1 ...
2) 增加全部内置功能下三行排列样式界面的演示及配置文件。 3) 增加上传及插入模板的功能,并在全部内置功能的演示中代替了插入EXCEL表格的功能(由于此功能需要服务器安装office2000,使用环境有限制,所以...
4.变量:js中的变量不需要提前指定类型,由赋值时动态决定 所有的变量都用var声明 5.数据类型: |--String(字符串类型) |--Number(数字类型) |--Boolean(布尔类型)0、-0、null、""、false/undefined或NaN,则该...
/head>中先增加一对<style></style>,在<style>标记写样式规则 样式规则:由选择器和样式声明组成 3.外部样式 独立于任何网页位置处,声明一个样式文件(.css为后缀),在文件中声明样式,在使用的...
10.6 选择一种表类型 10.6.1 静态(定长)表的特点 10.6.2 动态表的特点 10.6.3 压缩表的特点 10.6.4 内存(In-memory table)表的特点 10.7 其他优化技巧 10.8 使用你自己的基准测试 ...
支持统计信息动态更新 [experimental] 优化代价模型,对代价估算更精准 使用 `Count-Min Sketch` 更精确地估算点查的代价 支持分析更复杂的条件,尽可能充分的使用索引 支持通过 `STRAIGHT_JOIN` 语法手动指定 ...
10.6 选择一种表类型 10.6.1 静态(定长)表的特点 10.6.2 动态表的特点 10.6.3 压缩表的特点 10.6.4 内存(In-memory table)表的特点 10.7 其他优化技巧 10.8 使用你自己的基准测试...
alternate_table_rows 使表格中行与行之间的背景色交替变换 print 支持三种打印页面连接,文字连接、图片连接 preloaddisplay 预先加载页面,如果你的网站下载的速度比较慢,用这个比较好。 swftext 将Drm和Flash...
进入、退出页面的过渡转场效果,比如从中间打开、溶解...... Meta_Generator 网页 Meta 管理器,可以详细设置Meta Fix_Null_Links 把所有的“#”替换成“javascript”来避免一点击它,网页马上就翻到了顶部 ...
6.2 表表达式(Table Expressions) 6.2.1 派生表 6.2.2 公用表表达式 6.3 分析排名函数 6.3.1 行号 6.3.2 排名和密集排名(Dense Rank) 6.3.3 组号(Tile Number) 6.4 数字辅助表 6.5 缺失范围和现有范围...
•实例3-6 将数据库记录数据全部导入到Excel工作表(QueryTable集合) 58 •实例3-7 将数据库的某些字段的记录数据导入到Excel工作表(ADO) 59 •实例3-8 将数据库的某些字段记录数据导入到Excel工作表(DAO) 60 •...
6.2 表表达式(Table Expressions)246 6.2.1 派生表247 6.2.2 公用表表达式249 6.3 分析排名函数255 6.3.1 行号257 6.3.2 排名和密集排名(Dense Rank)271 6.3.3 组号(Tile Number)272 6.4 数字辅助表276 6.5 ...
6.2 表表达式(Table Expressions)246 6.2.1 派生表247 6.2.2 公用表表达式249 6.3 分析排名函数255 6.3.1 行号257 6.3.2 排名和密集排名(Dense Rank)271 6.3.3 组号(Tile Number)272 6.4 数字辅助表276...