- 浏览: 238340 次
- 性别:
- 来自: 北京
文章分类
最新评论
-
bihailantian_:
[/size]我而且额 ...
得到集合中的最后一条记录&和求基数偶数 -
w327569056w:
能发一份吗??谢谢 303430060@qq.com
在线购物系统毕业论文 &图书管理系统毕业论文 -
yuan23:
在线购物的系统,谢谢,464302726@qq.com ...
在线购物系统毕业论文 &图书管理系统毕业论文 -
君心可晴:
作业相关
想参考参考
1035236640@qq.com
LZ ...
在线购物系统毕业论文 &图书管理系统毕业论文 -
smith789:
该交论文了,题目相近,感谢博主!smith5623@126.c ...
在线购物系统毕业论文 &图书管理系统毕业论文
<html>
<head>
<title>abc</title>
<style type="text/css">
.brungrundColor {background-color:#DAA520;}
.fontSizeB {font-family:Verdana,Arial; font-size: 9pt;}
.borderClass {border-top:1px solid #cfcfcf;border-right:1px solid #cfcfcf;border-bottom:1px solid #cfcfcf;font-family:Verdana,Arial; font-size: 10pt;}
.clsBtn2w { MARGIN-RIGHT: 1px; BACKGROUND-IMAGE: url(../exclInputDemo/btngnd2c.gif); WIDTH: 46px; BORDER-TOP-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; HEIGHT: 22px; BORDER-BOTTOM-STYLE: none }
.clsBtn4w { MARGIN-RIGHT: 1px; BACKGROUND-IMAGE: url(../exclInputDemo/btngnd4c.gif); WIDTH: 68px; BORDER-TOP-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; HEIGHT: 22px; BORDER-BOTTOM-STYLE: none }
</style>
<SCRIPT src="../exclInputDemo/setday.js"></SCRIPT>
<SCRIPT language="javascript">
var curSrc=null;
function EditCell(){
var i=0,j=0;
var wid=0;
var Val='';
var Scr=event.srcElement; // 当前元素
if(Scr.tagName=="TD")
{
wid=Scr.clientWidth-3; // 列宽度
Val=Scr.innerHTML;
Scr.innerHTML="<input id='InputText' style='border:0px none; BACKGROUND-COLOR: transparent;#3399FF; height:14px;font-family:宋体;font-size:12px;color:#000000' onblur='return CellOut()' type='text' name='T1' size='10' "+(wid==0?"":"style='width:"+wid+"'") +" Value='" +MyTable.rows[i].cells[j].innerText+"'>";
InputText.value=Val;
curSrc=Scr;
Scr.children[0].focus();
}
}
function CellOut()
{
var Scr=event.srcElement;
var Val='';
if(curSrc)
{
Val=Scr.value;
curSrc.innerHTML=Val;
}
}
window.onload = function(){
//var pid = "PIAN200862292100000066";
var div1 = document.getElementById("div1");
if(pid == ""){
div1.style.display="";
}else{
div1.style.display="none";
}
}
</SCRIPT>
</head>
<body>
<div id="div1">
<table style='BORDER-COLLAPSE: collapse' border="0" width="100%" style="font-family:宋体;font-size:14px" cellpadding="0" cellspacing="0">
<tr height="22" class="brungrundColor">
<td style="border:1px solid #cfcfcf">保险单号</td>
<td class="borderClass">投保单号</td>
<td class="borderClass">起保时间</td>
<td class="borderClass">投保人(或单位)</td>
<td class="borderClass">投保人联系方式</td>
<td class="borderClass">险种</td>
<td class="borderClass">保险金额</td>
<td class="borderClass">保险费率</td>
<td class="borderClass">保单类型</td>
</tr>
<tr>
<td><input type="text" id="1" value="PIAN2009" maxlength="22" size="22"></td>
<td><input type="text" id="2" value="TIAN2009" maxlength="22" size="22"></td>
<td>
<INPUT style="background-color: #999999" id="starttime2" onclick="setday(this)" size="10" name="starttime" readOnly=true runat="server">
</td>
<td><input type="text" id="4" value=""></td>
<td><input type="text" id="5" value="" size="13"></td>
<td>
<select name="insurantType">
<option value="2" selected>地方政策性补贴</option>
<option value="1">中央政策性补贴</option>
</select>
</td>
<td><input type="text" id="7" value="10000" size="7"></td>
<td><input type="text" id="8" value="6" size="7"></td>
<td>
<select name="type" style="width:60px">
<option value="1" selected>标的</option>
<option value="2">分户</option>
</select>
</td>
</tr>
</table>
</div>
<table id='MyTable' style='BORDER-COLLAPSE: collapse' border="1" style="font-family:宋体;font-size:14px">
<tr row_num="0" class="brungrundColor" height="22">
<td width="4%" noWrap="noWrap"> </td>
<td width="12%" noWrap="noWrap">防疫码</td>
<td width="12%" noWrap="noWrap">内部编码</td>
<td width="8%" noWrap="noWrap">品种</td>
<td width="5%" noWrap="noWrap">蓄龄</td>
<td width="20%" noWrap="noWrap">养殖地点</td>
<td width="10%" noWrap="noWrap">保护姓名</td>
<td width="15%" noWrap="noWrap">身份证号</td>
<td width="8%" noWrap="noWrap">保护联系方式</td>
<td width="15%" noWrap="noWrap">备注</td>
</tr>
<tr row_num="1">
<td width="4%" onclick="return del();"><font size="2" color="red">删除</font></td>
<td width="12%" class="fontSizeB" noWrap="noWrap" OnClick="return EditCell(),add(parseInt(1)+1)"">200956100145200 </td>
<td width="12%" class="fontSizeB" noWrap="noWrap" OnClick="return EditCell(),add(parseInt(1)+1)"">WFY001 </td>
<td width="8%" class="fontSizeB" noWrap="noWrap" OnClick="return EditCell(),add(parseInt(1)+1)"">约克夏 </td>
<td width="5%" class="fontSizeB" noWrap="noWrap" OnClick="return EditCell(),add(parseInt(1)+1)"">34 </td>
<td width="20%" class="fontSizeB" noWrap="noWrap" OnClick="return EditCell(),add(parseInt(1)+1)"">北京市房山区蘑菇村 </td>
<td width="10%" class="fontSizeB" noWrap="noWrap" OnClick="return EditCell(),add(parseInt(1)+1)">李宝善 </td>
<td width="15%" class="fontSizeB" noWrap="noWrap" OnClick="return EditCell(),add(parseInt(1)+1)">110020529153681100 </td>
<td width="8%" class="fontSizeB" noWrap="noWrap" OnClick="return EditCell(),add(parseInt(1)+1)">13888888888 </td>
<td width="15%" class="fontSizeB" noWrap="noWrap" OnClick="return EditCell(),add(parseInt(1)+1)">其他 </td>
</tr>
</table>
<table>
<tr><td align="center"><font color="red" size="2">* 录入完成后请点击“确定完成”按钮,否则本次录入将作废 </font><input class="clsBtn4w" type="button" value="确定完成"/></td></tr>
</table>
<!-- //////////////////////////////JS 代码处///////////////////////////////////// -->
<script>
var row_num;
var table = document.getElementById('MyTable');
function add(){
var x=document.getElementById('MyTable').rows;
var index = x.length;
var y=x[index-1].cells; // 得到列
newRow = table.insertRow(index); //插入行
// newRow.row_num = "" + index;
var tmpStr;
for(var s=0;s<y.length;s++){
tmpStr = newRow.insertCell();
if(s==0){ //第一列显示删除
//tmpStr.innerText="删除";
tmpStr.innerHTML = "<input class='clsBtn2w' type='button' name='btn' value='删除'/>";
tmpStr.style.fontSize="10pt";
tmpStr.style.color="red";
}else{
tmpStr.style.fontSize="10pt";
}
}
var sms=x[index].cells;
// 为列添加事件
for (var i=0;i<y.length;i++)
{
if(i>0){
y[i].onclick = Function("return EditCell();");
sms[i].onclick = Function("return EditCell(),add();");
}else{
y[i].onclick = Function("return del();");
sms[i].onclick = Function("return del();");
}
}
row_num = table.rows.length;
//alert(document.getElementById('MyTable').innerHTML);
}
function del(){ // 还有删除最后一行后无法添加下列行 (未实现)
table.deleteRow(event.srcElement.parentElement.parentElement.rowIndex);
var x=document.getElementById('MyTable').rows;
var index = x.length;
var y=x[index].cells; // 得到列
newRow = table.insertRow(index); //插入行
//newRow.row_num = "" + index;
for (var i=0;i<y.length;i++)
{
if(i>0){
y[i].onclick = Function("return add();");
}else{
y[i].onclick = Function("return del();");
}
}
row_num = table.rows.length;
//alert(document.getElementById('MyTable').innerHTML);
}
</script>
</body>
</html>
<head>
<title>abc</title>
<style type="text/css">
.brungrundColor {background-color:#DAA520;}
.fontSizeB {font-family:Verdana,Arial; font-size: 9pt;}
.borderClass {border-top:1px solid #cfcfcf;border-right:1px solid #cfcfcf;border-bottom:1px solid #cfcfcf;font-family:Verdana,Arial; font-size: 10pt;}
.clsBtn2w { MARGIN-RIGHT: 1px; BACKGROUND-IMAGE: url(../exclInputDemo/btngnd2c.gif); WIDTH: 46px; BORDER-TOP-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; HEIGHT: 22px; BORDER-BOTTOM-STYLE: none }
.clsBtn4w { MARGIN-RIGHT: 1px; BACKGROUND-IMAGE: url(../exclInputDemo/btngnd4c.gif); WIDTH: 68px; BORDER-TOP-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; HEIGHT: 22px; BORDER-BOTTOM-STYLE: none }
</style>
<SCRIPT src="../exclInputDemo/setday.js"></SCRIPT>
<SCRIPT language="javascript">
var curSrc=null;
function EditCell(){
var i=0,j=0;
var wid=0;
var Val='';
var Scr=event.srcElement; // 当前元素
if(Scr.tagName=="TD")
{
wid=Scr.clientWidth-3; // 列宽度
Val=Scr.innerHTML;
Scr.innerHTML="<input id='InputText' style='border:0px none; BACKGROUND-COLOR: transparent;#3399FF; height:14px;font-family:宋体;font-size:12px;color:#000000' onblur='return CellOut()' type='text' name='T1' size='10' "+(wid==0?"":"style='width:"+wid+"'") +" Value='" +MyTable.rows[i].cells[j].innerText+"'>";
InputText.value=Val;
curSrc=Scr;
Scr.children[0].focus();
}
}
function CellOut()
{
var Scr=event.srcElement;
var Val='';
if(curSrc)
{
Val=Scr.value;
curSrc.innerHTML=Val;
}
}
window.onload = function(){
//var pid = "PIAN200862292100000066";
var div1 = document.getElementById("div1");
if(pid == ""){
div1.style.display="";
}else{
div1.style.display="none";
}
}
</SCRIPT>
</head>
<body>
<div id="div1">
<table style='BORDER-COLLAPSE: collapse' border="0" width="100%" style="font-family:宋体;font-size:14px" cellpadding="0" cellspacing="0">
<tr height="22" class="brungrundColor">
<td style="border:1px solid #cfcfcf">保险单号</td>
<td class="borderClass">投保单号</td>
<td class="borderClass">起保时间</td>
<td class="borderClass">投保人(或单位)</td>
<td class="borderClass">投保人联系方式</td>
<td class="borderClass">险种</td>
<td class="borderClass">保险金额</td>
<td class="borderClass">保险费率</td>
<td class="borderClass">保单类型</td>
</tr>
<tr>
<td><input type="text" id="1" value="PIAN2009" maxlength="22" size="22"></td>
<td><input type="text" id="2" value="TIAN2009" maxlength="22" size="22"></td>
<td>
<INPUT style="background-color: #999999" id="starttime2" onclick="setday(this)" size="10" name="starttime" readOnly=true runat="server">
</td>
<td><input type="text" id="4" value=""></td>
<td><input type="text" id="5" value="" size="13"></td>
<td>
<select name="insurantType">
<option value="2" selected>地方政策性补贴</option>
<option value="1">中央政策性补贴</option>
</select>
</td>
<td><input type="text" id="7" value="10000" size="7"></td>
<td><input type="text" id="8" value="6" size="7"></td>
<td>
<select name="type" style="width:60px">
<option value="1" selected>标的</option>
<option value="2">分户</option>
</select>
</td>
</tr>
</table>
</div>
<table id='MyTable' style='BORDER-COLLAPSE: collapse' border="1" style="font-family:宋体;font-size:14px">
<tr row_num="0" class="brungrundColor" height="22">
<td width="4%" noWrap="noWrap"> </td>
<td width="12%" noWrap="noWrap">防疫码</td>
<td width="12%" noWrap="noWrap">内部编码</td>
<td width="8%" noWrap="noWrap">品种</td>
<td width="5%" noWrap="noWrap">蓄龄</td>
<td width="20%" noWrap="noWrap">养殖地点</td>
<td width="10%" noWrap="noWrap">保护姓名</td>
<td width="15%" noWrap="noWrap">身份证号</td>
<td width="8%" noWrap="noWrap">保护联系方式</td>
<td width="15%" noWrap="noWrap">备注</td>
</tr>
<tr row_num="1">
<td width="4%" onclick="return del();"><font size="2" color="red">删除</font></td>
<td width="12%" class="fontSizeB" noWrap="noWrap" OnClick="return EditCell(),add(parseInt(1)+1)"">200956100145200 </td>
<td width="12%" class="fontSizeB" noWrap="noWrap" OnClick="return EditCell(),add(parseInt(1)+1)"">WFY001 </td>
<td width="8%" class="fontSizeB" noWrap="noWrap" OnClick="return EditCell(),add(parseInt(1)+1)"">约克夏 </td>
<td width="5%" class="fontSizeB" noWrap="noWrap" OnClick="return EditCell(),add(parseInt(1)+1)"">34 </td>
<td width="20%" class="fontSizeB" noWrap="noWrap" OnClick="return EditCell(),add(parseInt(1)+1)"">北京市房山区蘑菇村 </td>
<td width="10%" class="fontSizeB" noWrap="noWrap" OnClick="return EditCell(),add(parseInt(1)+1)">李宝善 </td>
<td width="15%" class="fontSizeB" noWrap="noWrap" OnClick="return EditCell(),add(parseInt(1)+1)">110020529153681100 </td>
<td width="8%" class="fontSizeB" noWrap="noWrap" OnClick="return EditCell(),add(parseInt(1)+1)">13888888888 </td>
<td width="15%" class="fontSizeB" noWrap="noWrap" OnClick="return EditCell(),add(parseInt(1)+1)">其他 </td>
</tr>
</table>
<table>
<tr><td align="center"><font color="red" size="2">* 录入完成后请点击“确定完成”按钮,否则本次录入将作废 </font><input class="clsBtn4w" type="button" value="确定完成"/></td></tr>
</table>
<!-- //////////////////////////////JS 代码处///////////////////////////////////// -->
<script>
var row_num;
var table = document.getElementById('MyTable');
function add(){
var x=document.getElementById('MyTable').rows;
var index = x.length;
var y=x[index-1].cells; // 得到列
newRow = table.insertRow(index); //插入行
// newRow.row_num = "" + index;
var tmpStr;
for(var s=0;s<y.length;s++){
tmpStr = newRow.insertCell();
if(s==0){ //第一列显示删除
//tmpStr.innerText="删除";
tmpStr.innerHTML = "<input class='clsBtn2w' type='button' name='btn' value='删除'/>";
tmpStr.style.fontSize="10pt";
tmpStr.style.color="red";
}else{
tmpStr.style.fontSize="10pt";
}
}
var sms=x[index].cells;
// 为列添加事件
for (var i=0;i<y.length;i++)
{
if(i>0){
y[i].onclick = Function("return EditCell();");
sms[i].onclick = Function("return EditCell(),add();");
}else{
y[i].onclick = Function("return del();");
sms[i].onclick = Function("return del();");
}
}
row_num = table.rows.length;
//alert(document.getElementById('MyTable').innerHTML);
}
function del(){ // 还有删除最后一行后无法添加下列行 (未实现)
table.deleteRow(event.srcElement.parentElement.parentElement.rowIndex);
var x=document.getElementById('MyTable').rows;
var index = x.length;
var y=x[index].cells; // 得到列
newRow = table.insertRow(index); //插入行
//newRow.row_num = "" + index;
for (var i=0;i<y.length;i++)
{
if(i>0){
y[i].onclick = Function("return add();");
}else{
y[i].onclick = Function("return del();");
}
}
row_num = table.rows.length;
//alert(document.getElementById('MyTable').innerHTML);
}
</script>
</body>
</html>
发表评论
-
struts2和struts1的区别
2010-02-03 16:36 993Struts1: action对象只有一个,不管谁去 ... -
Struts2.0学习笔记(一)命名空间和.xml文件配置
2010-02-03 16:31 1706首先要说声对不起,感谢关注我博客的朋友。近期因为换工 ... -
js 电子邮件验证
2009-07-17 10:24 2326<html> <title>aaa&l ... -
ZK 常用
2009-06-12 16:36 6558在一个页面中使用多种脚本语言 <zscript lang ... -
zk框架 特殊字符的替换方式
2009-04-27 15:15 1198特殊字符替换: < 用 < ... -
ZK框架 鼠标移动事件 & 移动在文本上显示信息
2009-04-23 14:06 3287例如一个超链接:在点击之前鼠标移动到连接上显示相应信息; 方法 ... -
js 最实用的一些操作
2009-04-01 13:58 11741. oncontextmenu="window.e ... -
Ajax状态值大全
2009-03-12 15:33 17370**:未被始化 1**:请求收到,继续处理 2**:操作 ... -
js 事件大全
2009-03-09 09:43 910一般事件 事件 浏览器支持 描述 onClick IE3|N ... -
汉洛塔算法
2008-12-03 16:21 1342private void MoveItem(int n, ... -
经典八皇后算法
2008-12-02 12:06 1629using System; using System.Data ... -
js 数字验证
2008-11-07 17:32 1101以下代码可直接复制使用: <SCRIPT LANGUAG ... -
实例 数组 广义表
2008-10-14 11:42 10861、 void RSh(int A[n],int k)//把数 ... -
数据结构四、串
2008-10-06 10:48 1951实例: void String_Reverse(Stringt ... -
数据结构三、栈与队列
2008-09-26 11:39 932基础实例:3.1 typedef stru ... -
数据结构二、线性表
2008-09-25 13:33 1151基础实例:2.1 Status DeleteK(SqList ... -
Web打印预览后 弹出窗口无法关闭
2008-09-23 11:17 4625jatoolsPrinter:打印控件出现了一个问题。这 ... -
数据结构一、基础实例
2008-09-22 17:58 896基础的数据结构实例: 1.1 void print_desc ... -
免费Web打印控件
2008-09-22 17:50 7353我现在的项目中有打印的模块,用的是一个免费的打印控件。 ... -
计算机 毕业论文
2008-09-10 18:06 1665自考毕业的时候为这篇论文可真是煞费脑筋啊,老师说了,就最普通的 ...
相关推荐
JQuery动态添加删除table行
HTML TABLE批量添加行与删除行.javascript实现。
js table添加、删除行。点“添加”按钮可以添加一行,每行后面都有一个删除按钮,可以删除所在行。
table JS 添加行和删除行 实现JS添加table的一行和删除一行技术
使用javascript实现table动态增加删除行列。
JS动态添加、删除Table行排序(删除整行、删除整列)JS动态添加、删除Table行排序(删除整行、删除整列)
支持table动态编辑,添加行或是删除行,第一行不允许删除。
下面小编就为大家带来一篇利用jquery给指定的table动态添加一行、删除一行的方法。小编觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随小编过来看看吧
用js实现对table添加行、删除行、复制行的操作。
javascript添加删除table行
动态table添加或者删除一行使序号重新排序,placeholder、id和name同时重新排序
本文实例为大家分享了bootstrap table双击可编辑的具体代码,供大家参考,具体内容如下 html: <table class=table id=para_table> 名称 值 操作 <td style=tex
支持动态删除一行。 先演示结果,如中意了在好好研究代码。 1、原始界面如下: 2、添加一行,如要添加一行需点击“添加”按钮,现点击两下会自动添加两行,效果如下截图: 3、删除一行,如要删除指定行,先要选中...
jquery table 添加、删除行、列
table添加、删减行,单元格添加、修改、删除标记,对于指定标记默认生成显示,浮动定位且不会产生水平导航条
table动态增加一行,点击增加可增加,点击删除可以进行删除
通过js来控制动态加一行或删除一行,非常适合table中td一行的添加和删除。
今天在项目中,刚好用到给指定的table添加一行、删除一行,就直接找google,搜出来的东西不尽如人意,不是功能不好就是千篇一律,简直浪费时间还不讨好,于是乎就自己动手封装个,现就把代码分享出来,避免大伙重复...
纯js实现动态为table添加删除行。实用的代码