动态创建删除table表


function createTable(){
var i=document.getElementById("sumnumber").value;
i=parseInt(i)+1;
document.getElementById("sumnumber").value=i;
var div = document.getElementById("model2");
var table = document.createElement("table");//创建table
table.width="94%";
table.border="0";
table.cellpadding="0";
table.cellspacing="0";
table.id="submenu6688";


var row = table.insertRow();//创建一行
var cell = row.insertCell();//创建一个单元
// cell.style.backgroundColor = "#999999";
cell.colSpan="4";
cell.innerHTML=" ";

var row = table.insertRow();
cell = row.insertCell();//创建一个单元
cell.height="24";
cell.align="right";

cell.innerHTML="<span class='STYLE19'>* </span>您是被保险人的:";


//div.appendChild(table);

cell=row.insertCell();
cell.width="250";
cell.align="left";
cell.innerHTML="<select id='sltrelation"+i+"' height='20px' name='sltrelation"+i+"'><option selected>请选择</option> <option>配偶</option><option>子女</option><option>父母</option><option>其它</option></select>"

cell=row.insertCell();
cell.width="100";
cell.innerHTML="&nbsp;";
cell=row.insertCell();
cell.width="100";
cell.innerHTML="&nbsp;";

// 增加一行
row=table.insertRow();
cell=row.insertCell();
cell.height="24";
cell.align="right";
cell.innerHTML="<span class='STYLE19'>* </span>被保险人姓名:";
cell=row.insertCell();
cell.align="left";
cell.innerHTML="<input id='txtsubto"+i+"' type='text' name='txtsubto"+i+"' />";

cell = row.insertCell();//创建一个单元
cell.height="24";
cell.align="right";
cell.innerHTML="<span class='STYLE19'>* </span>英文名/拼音:";
cell=row.insertCell();
cell.align="left";
cell.innerHTML="<input type='text' id='txtEnName"+i+"' name='txtEnName"+i+"' width='100px'/>";

row=table.insertRow();
cell=row.insertCell();
cell.height="24";
cell.align="right";
cell.innerHTML="<span class='STYLE19'>* </span>证件类型:";
cell=row.insertCell();
cell.align="left";
cell.innerHTML="<select id='sltsfz' name='sltsfz"+i+"'><option selected='true'>请选择</option><option>身份证</option><option>护照</option></select>";
cell=row.insertCell();
cell.align="right";
cell.innerHTML="<span class='STYLE19'>* </span>证件号码:";
cell=row.insertCell();
cell.align="left";
cell.innerHTML="<input id='txtzjnumber"+i+"' width='160px' type='text' name='txtzjnumber"+i+"' />";

row=table.insertRow();
cell=row.insertCell();
cell.height="24";
cell.align="right";
cell.innerHTML="<span class='STYLE19'>* </span>出生日期:";
cell=row.insertCell();
cell.align="left";
cell.innerHTML="<script language='javascript' type='text/javascript' src='DatePicker/WdatePicker.js'><"+"/script><input id='txtborndate"+i+"' width='100px' type='text' name='txtborndate"+i+"' onClick='WdatePicker()'/>";

cell=row.insertCell();
cell.align="right";
cell.innerHTML="<span class='STYLE19'>* </span> 性别:";
cell=row.insertCell();
cell.align="left";
cell.innerHTML="<select id='sltsex"+i+"' height='20px' name='sltsex"+i+"' ><option selected>请选择</option><option>男</option><option>女</option></select>"




row=table.insertRow();
cell=row.insertCell();
cell.height="24px";
cell.align="right";
cell.innerHTML="联系电话:";
cell=row.insertCell();
cell.colSpan="3";
cell.innerHTML="<input id='txtphone"+i+"' width='160px' type='text' name='txtphone"+i+"' /><label><span class='STYLE21'>非必填项,建议填写以便享受短信服务</span></label>";
cell.align="left";
cell=row.insertCell();

row=table.insertRow();
cell=row.insertCell();
cell.innerHTML="&nbsp;";
cell=row.insertCell();
cell.innerHTML="&nbsp;";
cell=row.insertCell();
cell.innerHTML="&nbsp;";
cell=row.insertCell();
cell.innerHTML="&nbsp;";
div.appendChild(table);
var oldmoney=document.getElementById("cdstree").innerHTML;
var metamoney=document.getElementById("metamoney").value;
var currentmoney=parseInt(oldmoney)+parseInt(metamoney);
document.getElementById("cdstree").innerHTML=currentmoney;
document.getElementById("fenshu").innerHTML=i;
}
function del()
{
var div = document.getElementById("model2");
var i=document.getElementById("sumnumber").value;
i=parseInt(i);
if(i>1)
{
div.removeChild(div.lastChild);
i=i-1;
document.getElementById("sumnumber").value=i;
var oldmoney=document.getElementById("cdstree").innerHTML;
var metamoney=document.getElementById("metamoney").value;
var currentmoney=parseInt(oldmoney)-parseInt(metamoney);
document.getElementById("cdstree").innerHTML=currentmoney;
document.getElementById("fenshu").innerHTML=i;
}
}

优质内容筛选与推荐>>
1、can't resolve symbol 'R' ...
2、Castle ActiveRecord 使用动态填写参数方式配置数据库连接
3、分布式事务的解决方案
4、总结两种方式获取接口提供的数据
5、poj 2395


长按二维码向我转账

受苹果公司新规定影响,微信 iOS 版的赞赏功能被关闭,可通过二维码转账支持公众号。

    阅读
    好看
    已推荐到看一看
    你的朋友可以在“发现”-“看一看”看到你认为好看的文章。
    已取消,“好看”想法已同步删除
    已推荐到看一看 和朋友分享想法
    最多200字,当前共 发送

    已发送

    朋友将在看一看看到

    确定
    分享你的想法...
    取消

    分享想法到看一看

    确定
    最多200字,当前共

    发送中

    网络异常,请稍后重试

    微信扫一扫
    关注该公众号