日期:2014-05-17  浏览次数:21449 次

按一下按钮增加一行
有个按钮 "增加“,一按下就会在table多一行
<tr>
<td> 工号 </td>
<td   width= "172 "> <input   name= "idno "   type= "text "   id= "idno "> </td>
<td   width= "51 "> 姓名 </td>
<td   width= "196 "> <input   name= "name "   type= "text "   id= "name "> </td>
<td   width= "52 "> 部门 </td>
<td   width= "235 "> <input   name= "deptnm "   type= "text "   id= "deptnm ">   <input   name= 'Submit6 '   type= 'button '   class= 'button-style '   value= '搜索 '   onClick= 'SelectPerson(); '   style= 'cursor:hand; '> </td>
</tr>
有另一个按钮“删除”,一按下
上面一行就没了


------解决方案--------------------
zengjiaye.asp:

<html>
<head>
<title> </title>
<meta http-equiv= "Content-Type " content= "text/html; charset=gb2312 ">
<style type= "text/css ">
<!--
.font105 { font-size:10.5pt}
.engfontv9 { font-family: Verdana; font-size: 9pt}
.engfontv105 { font-family: Verdana; font-size: 10.5pt}
form {font-size: 9pt}
input {font-size: 9pt}
select {font-size: 9pt}
textarea {font-size: 9pt}
body { font-size: 9pt}
form.engv {font-family: Verdana; font-size:9pt}
input.engv {font-family: Verdana; font-size:9pt}
select.engv {font-family: Verdana; font-size:9pt}
textarea.engv {font-family: Verdana; font-size:9pt}
input.noborder {margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 1px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px;height: 13px;border-width: 0px 0px 0px 0px;text-align:center}
body { font-size: 9pt}
td { font-size: 9pt}
a:link {color: #004080; text-decoration: none}
a:visited {color: #004080; text-decoration: none}
a:hover { color: #BE2143; text-decoration: underline}
a.9pt:link {font-size: 9pt; color: #004080; text-decoration: none}
a.9pt:visited { font-size: 9pt; color: #004080; text-decoration: none}
a.9pt:hover { font-size: 9pt; color: #BE2143; text-decoration: underline}
-->
</style>
<script language=javascript>
function tick()
{
theform.plswait.value=theform.plswait.value+ '. ';
window.setTimeout( "tick() ",1000);
}
allCount=0;


function addline()
{
newRow=datatable.insertRow(datatable.rows.length);
newRow.ln=allCount;
newRow.id= "line "+allCount;
c0=newRow.insertCell(0);
c0.bgColor= "#FFFFFF ";
c0.innerHTML= " <input size=10 class=noborder name=sCatalog> ";
c1=newRow.insertCell(1);
c1.bgColor= "#FFFFFF ";
c1.innerHTML= " <input size=12 class=noborder name=sClass> ";
c2=newRow.insertCell(2);
c2.bgColor= "#FFFFFF ";
c2.innerHTML= " <input size=8 class=noborder name=sMaterial> ";
c3=newRow.insertCell(3);
c3.bgColor= "#FFFFFF ";
c3.align= "CENTER ";
c3.innerHTML= " <input type=button class=noborder value=插入 style= 'cursor:hand;background-color:#FFFFFF ' onmouseover=this.style.color= '#C0C0C0 ' onmouseout=this.style.color= '#000000 ' onclick=insertline(line "+allCount+ ")> ";
c4=newRow.insertCe