C
citybug_ch
Unregistered / Unconfirmed
GUEST, unregistred user!
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html;
charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
</head>
<body>
<form method="POST" action="login.asp" name="form1">
<p> </p>
<div align="left">
<script language="javascript">
function B5_click()
{
var array1=new Array();
var old_linenum,new_linenum;
var k,i;
var str;
old_linenum=parseInt(form1.LineNum2.value);
new_linenum=old_linenum + 1;
form1.LineNum2.value=new_linenum;
//把已经有的数据保存在数组中
array1=new Array(old_linenum,3);
k=0;
for (i=0;i<form1.elements.length;i++)
{
if (form1.elements.name=='T31'+k)
{
array1[k,0]=form1.elements.value;
}
if (form1.elements.name=='T32'+k)
{
array1[k,1]=form1.elements.value;
}
if (form1.elements.name=='T33'+k)
{
array1[k,2]=form1.elements.value;
k=k + 1;
}
}
alert(array1[0]+ ' ' +array1[1]+ ' ' +array1[2]);
str='';
k=0;
for(i=0;i<form1.elements.length;i++)
{
if (form1.elements.name=='T31'+k)
{
str+=array1[k,0];
}
if (form1.elements.name=='T32'+k)
{
str+=array1[k,1];
}
if (form1.elements.name=='T33'+k)
{
str+=array1[k,2];
k=k + 1;
}
}
alert(str);
str='<br>';
str+='<tr>';
str+='<td width="76" height="18" align="center">标题7</td>';
str+='<td width="92" height="18" align="center">标题8</td>';
str+='<td width="174" height="18" align="center">标题9</td>';
str+='<td width="179" height="18"></td>';
str+='</tr>';
for(i=0;i<=new_linenum;i++)
{
str+='<tr>';
str+=' <td width="76" height="19"><input type="text" name="T31'+i+'" size="20"></td>';
str+=' <td width="92" height="19"><input type="text" name="T32'+i+'" size="20"></td>';
str+=' <td width="174" height="19"><input type="text" name="T33'+i+'" size="20"></td>';
str+=' <td width="179" height="19" align="right">';
if (i==new_linenum)
{
str+='<input type="button" value="增加" name="B5" language="javascript" onclick="B5_click()">';
}
str+=' </td>';
str+='</tr>';
}
//alert(str);
//document.write(str);
window.ItemAdd.innerHTML=str+'<tr>';
//把数组中的数据写到表单中
k=0;
for(i=0;i<form1.elements.length;i++)
{
if (form1.elements.name=='T31'+k)
{
form1.elements.value=array1[k,0];
}
if (form1.elements.name=='T32'+k)
{
form1.elements.value=array1[k,1];
}
if (form1.elements.name=='T33'+k)
{
form1.elements.value=array1[k,2];
k=k + 1;
}
}
}
</script>
<table border="0" width="549" height="49" cellspacing="0" cellpadding="0" id="ItemAdd">
<tr>
<td width="76" height="18" align="center">标题7</td>
<td width="92" height="18" align="center">标题8</td>
<td width="174" height="18" align="center">标题9</td>
<td width="179" height="18"></td>
</tr>
<tr>
<td width="76" height="19"><input type="text" name="T310" size="20"></td>
<td width="92" height="19"><input type="text" name="T320" size="20"></td>
<td width="174" height="19"><input type="text" name="T330" size="20"></td>
<td width="179" height="19" align="right">
<input type="button" value="增加" name="B5" language="javascript" onclick="B5_click()">
</td>
</tr>
</table>
</div>
<input type="text" name="LineNum2" value="<%=linenum2%>">
<input type="text" name="BC">
<p><input type="submit" value="提交" name="B1"></p>
</form>
</body>
</html>