请高手帮忙?超困难的问题. ( 积分: 30 )

  • 主题发起人 主题发起人 haoshan
  • 开始时间 开始时间
H

haoshan

Unregistered / Unconfirmed
GUEST, unregistred user!
现在的问题是,可以增加一行,但不能删除,前十行中前三个是级连的选择框,但增加的行级连菜单就实现不了.我找了好几天也没找道到错误在哪,请大家帮忙!
<html>
<head>
<title>Untitleddo
cument</title>
<meta http-equiv=&quot;Content-Type&quot;
content=&quot;text/html;
charset=gb2312&quot;>
</head>
<script language=&quot;JavaScript&quot;
src=&quot;sy/blc_zm.js&quot;
type=&quot;text/JavaScript&quot;></script>
<SCRIPT language=javascript>
var line=2
function delIt()
{
line=parseInt(event.srcElement.ln,10)

if (line>0)
for (i=1;i<PLList.rows.length;i++)
if (tdt.ln==line)
{
if (do
cument.ecform.medication.value.length>0 )
if (!confirm(&quot;Are you sure you want to delete this record?&quot;))
return
PLList.deleteRow(i)
}
}
function mouseOver()
{
event.srcElement.className=&quot;delMouseOver&quot;
}
function mouseOut()
{
event.srcElement.className=&quot;scheduleButtonVisible&quot;
}
</script>
<body bgcolor=&quot;#FFFFFF&quot;
text=&quot;#000000&quot;>
<form action=sy/save_insert_del.asp method =&quot;POST&quot;
name=&quot;frm&quot;
style=&quot;border-style: solid;
border-width: 1px;
padding-left: 4px;
padding-right: 4px;
padding-top: 1px;
padding-bottom: 1px&quot;>
<TABLE id=fileinput0 width=&quot;876&quot;
bgcolor=&quot;#DDEEFF&quot;>
<tr>
<td width=&quot;9%&quot;
style=&quot;border-style: solid;
border-width: 1px&quot;
bgcolor=&quot;#FFFFFF&quot;>
<p align=&quot;center&quot;>类别</td>
<td width=&quot;11%&quot;
style=&quot;border-style: solid;
border-width: 1px&quot;
bgcolor=&quot;#FFFFFF&quot;>
<p align=&quot;center&quot;>物资名称</td>
<td width=&quot;11%&quot;
style=&quot;border-style: solid;
border-width: 1px&quot;
bgcolor=&quot;#FFFFFF&quot;>
<p align=&quot;center&quot;>规格型号</td>
<td width=&quot;9%&quot;
style=&quot;border-style: solid;
border-width: 1px&quot;
bgcolor=&quot;#FFFFFF&quot;>
<p align=&quot;center&quot;>计量单位</td>
<td width=&quot;9%&quot;
style=&quot;border-style: solid;
border-width: 1px&quot;
bgcolor=&quot;#FFFFFF&quot;>
<p align=&quot;center&quot;>税率</td>
<td width=&quot;11%&quot;
style=&quot;border-style: solid;
border-width: 1px&quot;
bgcolor=&quot;#FFFFFF&quot;>
<p align=&quot;center&quot;>数量</td>
<td width=&quot;9%&quot;
style=&quot;border-style: solid;
border-width: 1px&quot;
bgcolor=&quot;#FFFFFF&quot;>
<p align=&quot;center&quot;>不含税单价</td>
<td width=&quot;13%&quot;
style=&quot;border-style: solid;
border-width: 1px&quot;
bgcolor=&quot;#FFFFFF&quot;>
<p align=&quot;center&quot;>含税金额</td>
<td width=&quot;13%&quot;
style=&quot;border-style: solid;
border-width: 1px&quot;
bgcolor=&quot;#FFFFFF&quot;>
<p align=&quot;center&quot;>税额</td>
<td width=&quot;5%&quot;
style=&quot;border-style: solid;
border-width: 1px&quot;
bgcolor=&quot;#FFFFFF&quot;>
<p align=&quot;center&quot;>删除</td>
</tr>
</TABLE>
<% for i=0 to 9 %>
<table id=fileinput<%=i+1%> width=&quot;877&quot;
bgcolor=&quot;#DDEEFF&quot;>
<tr>
<td width=&quot;9%&quot;
bordercolor=&quot;#FFFFFF&quot;>
<select name=lb style=&quot;WIDTH:75;
height:19&quot;
onchange=&quot;MulSelect(1,<%=i%>)&quot;
tabindex=&quot;<%=i+2%>&quot;></select></td>
<td bgcolor=&quot;#FFFFFF&quot;
width=&quot;10%&quot;
bordercolor=&quot;#FFFFFF&quot;>
<select name=sname style=&quot;WIDTH:90;
height:19&quot;
onchange=&quot;MulSelect(2,<%=i%>)&quot;
tabindex=&quot;<%=i+2%>&quot;></select></td>
<td bgcolor=&quot;#FFFFFF&quot;
width=&quot;10%&quot;
bordercolor=&quot;#FFFFFF&quot;>
<select name=ggxh style=&quot;WIDTH:91;
height:19&quot;
onkeydown=&quot;return tabclick()&quot;
tabindex=&quot;<%=i+2%>&quot;></select></td>
<td bgcolor=&quot;#FFFFFF&quot;
width=&quot;8%&quot;
bordercolor=&quot;#FFFFFF&quot;>
<input type=&quot;text&quot;
name=&quot;a4&quot;
size=&quot;10&quot;
style=&quot;border=0;&quot;
onkeydown=&quot;return tabclick()&quot;
tabindex=&quot;<%=i+2%>&quot;></td>
<td bgcolor=&quot;#FFFFFF&quot;
width=&quot;9%&quot;
bordercolor=&quot;#FFFFFF&quot;>
<input type=&quot;text&quot;
name=&quot;a5&quot;
size=&quot;10&quot;
style=&quot;border=0;&quot;
onKeypress=&quot;return (/[/d.]/.test(String.fromCharCode(event.keyCode)))&quot;
onchange=get(<%=i%>) onkeydown=&quot;return tabclick()&quot;
tabindex=&quot;<%=i+2%>&quot;></td>
<td bgcolor=&quot;#FFFFFF&quot;
width=&quot;10%&quot;
bordercolor=&quot;#FFFFFF&quot;>
<input type=&quot;text&quot;
name=&quot;a6&quot;
size=&quot;12&quot;
style=&quot;border=0;&quot;
onchange=get(<%=i%>) onKeypress=&quot;
if (event.keyCode < 45 || event.keyCode > 57) event.returnValue = false;&quot;
onkeydown=&quot;return tabclick()&quot;
tabindex=&quot;<%=i+2%>&quot;></td>
<td bgcolor=&quot;#FFFFFF&quot;
width=&quot;9%&quot;
bordercolor=&quot;#FFFFFF&quot;><input type=&quot;text&quot;
name=&quot;a7&quot;
size=&quot;10&quot;
style=&quot;border=0;&quot;
onchange=get(<%=i%>) tabindex=&quot;<%=i+2%>&quot;></td>
<td bgcolor=&quot;#FFFFFF&quot;
width=&quot;12%&quot;
bordercolor=&quot;#FFFFFF&quot;><input type=&quot;text&quot;
name=&quot;a8&quot;
size=&quot;14&quot;
style=&quot;border=0;&quot;
onkeydown=&quot;return tabclick()&quot;
tabindex=&quot;<%=i+2%>&quot;></td>
<td bgcolor=&quot;#FFFFFF&quot;
width=&quot;13%&quot;
bordercolor=&quot;#FFFFFF&quot;><input type=&quot;text&quot;
name=&quot;a9&quot;
size=&quot;14&quot;
style=&quot;border=0;&quot;
onkeydown=&quot;return tabclick()&quot;
tabindex=&quot;<%=i+2%>&quot;></td>
<td bgcolor=&quot;#FFFFFF&quot;
width=&quot;5%&quot;
bordercolor=&quot;#FFFFFF&quot;><input type=button value=删除 class=cbutton OnClick=&quot;DelFileInput(<%=i+1%>)&quot;
onkeydown=&quot;return tabclick()&quot;
tabindex=&quot;<%=i+2%>&quot;></td>
</tr>
</TABLE>
<% next %>
<input type=&quot;button&quot;
name=&quot;add_line&quot;
value=&quot;增加下一行&quot;
OnClick=&quot;AddFileInput()&quot;
onkeydown=&quot;return tabclick()&quot;>
<script language=&quot;VBScript&quot;>
NowFileInputNo = 11
NowFileInputCount =10
idx=12
Sub AddFileInput()
HTMLSrc = &quot;<table id=fileinput&quot;&amp;NowFileInputNo&amp;&quot;
width=&quot;&quot;877&quot;&quot;
bgcolor=&quot;&quot;#DDEEFF&quot;&quot;><tr> <td width=&quot;&quot;9%&quot;&quot;
bordercolor=&quot;&quot;#FFFFFF&quot;&quot;><select name=lb style=&quot;&quot;WIDTH:75;
height:19&quot;&quot;
onchange=&quot;&quot;MulSelect(1,&quot;&amp;NowFileInputCount&amp;&quot;)&quot;&quot;
tabindex=&quot;&quot;&quot;&amp;idx&amp;&quot;&quot;&quot;></select></td><td bgcolor=&quot;&quot;#FFFFFF&quot;&quot;
width=&quot;&quot;10%&quot;&quot;
bordercolor=&quot;&quot;#FFFFFF&quot;&quot;><select name=sname style=&quot;&quot;WIDTH:90;
height:19&quot;&quot;
onchange=&quot;&quot;MulSelect(2,&quot;&amp;NowFileInputCount&amp;&quot;)&quot;&quot;
tabindex=&quot;&quot;&quot;&amp;idx&amp;&quot;&quot;&quot;></select></td>&quot;
HTMLSrc = HTMLSrc &amp;&quot;<td bgcolor=&quot;&quot;#FFFFFF&quot;&quot;
width=&quot;&quot;10%&quot;&quot;
bordercolor=&quot;&quot;#FFFFFF&quot;&quot;><select name=ggxh style=&quot;&quot;WIDTH:91;
height:19&quot;&quot;
onkeydown=&quot;&quot;return tabclick()&quot;&quot;
tabindex=&quot;&quot;&quot;&amp;idx&amp;&quot;&quot;&quot;></select></td>&quot;
HTMLSrc = HTMLSrc &amp;&quot;<td bgcolor=&quot;&quot;#FFFFFF&quot;&quot;
width=&quot;&quot;8%&quot;&quot;
bordercolor=&quot;&quot;#FFFFFF&quot;&quot;><input type=&quot;&quot;text&quot;&quot;
name=&quot;&quot;a4&quot;&quot;
size=&quot;&quot;10&quot;&quot;
style=&quot;&quot;border=0;&quot;&quot;
onkeydown=&quot;&quot;return tabclick()&quot;&quot;
tabindex=&quot;&quot;&quot;&amp;idx&amp;&quot;&quot;&quot;></td><td bgcolor=&quot;&quot;#FFFFFF&quot;&quot;
width=&quot;&quot;9%&quot;&quot;
bordercolor=&quot;&quot;#FFFFFF&quot;&quot;><input type=&quot;&quot;text&quot;&quot;
name=&quot;&quot;a5&quot;&quot;
size=&quot;&quot;10&quot;&quot;
style=&quot;&quot;border=0;&quot;&quot;
onKeypress=&quot;&quot;return (/[/d.]/.test(String.fromCharCode(event.keyCode)))&quot;&quot;
onchange=get(&quot;&amp;NowFileInputCount&amp;&quot;) onkeydown=&quot;&quot;return tabclick()&quot;&quot;
tabindex=&quot;&quot;&quot;&amp;idx&amp;&quot;&quot;&quot;></td>&quot;
HTMLSrc = HTMLSrc &amp;&quot;<td bgcolor=&quot;&quot;#FFFFFF&quot;&quot;
width=&quot;&quot;10%&quot;&quot;
bordercolor=&quot;&quot;#FFFFFF&quot;&quot;><input type=&quot;&quot;text&quot;&quot;
name=&quot;&quot;a6&quot;&quot;
size=&quot;&quot;12&quot;&quot;
style=&quot;&quot;border=0;&quot;&quot;
onchange=get(&quot;&amp;NowFileInputCount&amp;&quot;) onKeypress=&quot;&quot;
if (event.keyCode < 45 || event.keyCode > 57) event.returnValue = false;&quot;&quot;
onkeydown=&quot;&quot;return tabclick()&quot;&quot;
tabindex=&quot;&amp;idx&amp;&quot;></td>&quot;
HTMLSrc = HTMLSrc &amp;&quot;<td bgcolor=&quot;&quot;#FFFFFF&quot;&quot;
width=&quot;&quot;9%&quot;&quot;
bordercolor=&quot;&quot;#FFFFFF&quot;&quot;><input type=&quot;&quot;text&quot;&quot;
name=&quot;&quot;a7&quot;&quot;
size=&quot;&quot;10&quot;&quot;
style=&quot;&quot;border=0;&quot;&quot;
onchange=get(&quot;&amp;NowFileInputCount&amp;&quot;) tabindex=&quot;&quot;&quot;&amp;idx&amp;&quot;&quot;&quot;></td><td bgcolor=&quot;&quot;#FFFFFF&quot;&quot;
width=&quot;&quot;12%&quot;&quot;
bordercolor=&quot;&quot;#FFFFFF&quot;&quot;><input type=&quot;&quot;text&quot;&quot;
name=&quot;&quot;a8&quot;&quot;
size=&quot;&quot;14&quot;&quot;
style=&quot;&quot;border=0;&quot;&quot;
onkeydown=&quot;&quot;return tabclick()&quot;&quot;
tabindex=&quot;&quot;&quot;&amp;idx&amp;&quot;&quot;&quot;></td>&quot;
HTMLSrc = HTMLSrc &amp;&quot;<td bgcolor=&quot;&quot;#FFFFFF&quot;&quot;
width=&quot;&quot;13%&quot;&quot;
bordercolor=&quot;&quot;#FFFFFF&quot;&quot;><input type=&quot;&quot;text&quot;&quot;
name=&quot;&quot;a9&quot;&quot;
size=&quot;&quot;14&quot;&quot;
style=&quot;&quot;border=0;&quot;&quot;
onkeydown=&quot;&quot;return tabclick()&quot;&quot;
tabindex=&quot;&quot;&quot;&amp;idx&amp;&quot;&quot;&quot;></td><td bgcolor=&quot;&quot;#FFFFFF&quot;&quot;
width=&quot;&quot;5%&quot;&quot;
bordercolor=&quot;&quot;#FFFFFF&quot;&quot;><input type=button value=删除 class=cbutton OnClick=&quot;&quot;DelFileInput(&quot;&amp;NowFileInputNo&amp;&quot;)&quot;&quot;
onkeydown=&quot;&quot;return tabclick()&quot;&quot;
tabindex=&quot;&quot;&quot;&amp;idx&amp;&quot;&quot;&quot;></td></tr></TABLE>&quot;
HTMLSrc = HTMLSrc &amp;
vbcrlf
do
cument.all.add_line.InsertAdjacentHTML &quot;beforebegin
&quot;, HTMLSrc
Call MulSelect(0,NowFileInputCount)
idx=idx+1
NowFileInputNo = NowFileInputNo + 1
NowFileInputCount = NowFileInputCount + 1
End Sub
Sub DelFileInput(tableno)
do
cument.all(&quot;FileInput&quot;&amp;
tableno).outerHTML = &quot;&quot;
NowFileInputCount = NowFileInputCount - 1
End Sub
</script>
<script>
// 三级联动
var arrSel=[&quot;lb&quot;,&quot;sname&quot;,&quot;ggxh&quot;]
arrData=[];
// 从数据库中读出三级联动的数据, 保存到 arrData 数组中(二维数组)
<%
dim conn,rs
set conn = Server.CreateObject(&quot;ADODB.Connection&quot;)
conn.Open &quot;Provider=Microsoft.Jet.OLEDB.4.0;Data Source=&quot;
&amp;
Server.mappath(&quot;rktz/rktz.mdb&quot;) &amp;
&quot;;Persist Security Info=False&quot;
set rs=conn.execute(&quot;select * from spxx&quot;)
do while not rs.eof
%>
arrData[arrData.length]=[&quot;<%=trim(rs(&quot;lb&quot;))%>&quot;,&quot;<%=trim(rs(&quot;sname&quot;))%>&quot;,&quot;<%=trim(rs(&quot;ggxh&quot;))%>&quot;]
<%
rs.movenext
loop
rs.close:set rs=nothing
conn.close:set conn=nothing
%>
</script>
<script language=javascript >
//单价金额的级连函数
function get(h){
var m;
m=document.all.a5(h).value;
document.all.a8(h).value=document.all.a7(h).value*m*document.all.a6(h).value;
m=m-1;
document.all.a9(h).value=document.all.a7(h).value*m*document.all.a6(h).value}
function tabclick() {
if (window.event.keyCode==13) {
window.event.keyCode=9
}
}

// 下拉框选择变化时触发的函数,用于重新生成其下级下拉框
// num : 下拉框的级数, 1 表示最顶级
function MulSelect(num,k)
{
var i,j,arrTemp=[];
// 取得表单当前触发的下拉框的父级下拉框的值, 存放于 arrTemp 数组中(即不需要改变的值)
for(i=0;i<num;i++)
{
arrTemp=eval(&quot;document.frm.&quot;+arrSel)(k).value
}
if(num<arrSel.length)
{
// 对于触发下拉框的下一级的下拉框
with(eval(&quot;document.frm.&quot;+arrSel[num])(k))
{
// 先清空内容
length=0
// 对所有的记录遍历
for(i=0;i<arrData.length;i++)
{
var find=false
// 如果父级下拉框的记录不是当前选中的值,则跳过
for(j=0;j<num;j++)
{
if(arrTemp[j]!=arrData[j])
{
break;
}
}
if(j!=num)
{
continue;
}
// 这里已经可以保证第 i 项记录的数据属于当前选项的子数据
// 检查循环过程中是否已经添加了该选项,如果已有了, 则 fine = true
for(m=0;m<options.length;m++)
{
if(options[m].text==arrData[num])
{
find=true
}
}
// 若当前没有选项或者尚未添加该选项项,则添加之
if(length==0||!find)
{
options[options.length]=new Option(arrData[num],arrData[num])
}
}
// 递归调用生成下一级菜单的内容
MulSelect((num+1),k)
}
}
MulSelect(0,k+1)}
// 调用联动函数初始化下拉框
MulSelect(0,0)
</script>
<p><input type=&quot;submit&quot;
value=&quot;提交&quot;
name=&quot;B1&quot;><input type=&quot;reset&quot;
value=&quot;重置&quot;
name=&quot;B2&quot;></p>
</form>
</body>
</html>
 
现在的问题是,可以增加一行,但不能删除,前十行中前三个是级连的选择框,但增加的行级连菜单就实现不了.我找了好几天也没找道到错误在哪,请大家帮忙!
<html>
<head>
<title>Untitleddo
cument</title>
<meta http-equiv=&quot;Content-Type&quot;
content=&quot;text/html;
charset=gb2312&quot;>
</head>
<script language=&quot;JavaScript&quot;
src=&quot;sy/blc_zm.js&quot;
type=&quot;text/JavaScript&quot;></script>
<SCRIPT language=javascript>
var line=2
function delIt()
{
line=parseInt(event.srcElement.ln,10)

if (line>0)
for (i=1;i<PLList.rows.length;i++)
if (tdt.ln==line)
{
if (do
cument.ecform.medication.value.length>0 )
if (!confirm(&quot;Are you sure you want to delete this record?&quot;))
return
PLList.deleteRow(i)
}
}
function mouseOver()
{
event.srcElement.className=&quot;delMouseOver&quot;
}
function mouseOut()
{
event.srcElement.className=&quot;scheduleButtonVisible&quot;
}
</script>
<body bgcolor=&quot;#FFFFFF&quot;
text=&quot;#000000&quot;>
<form action=sy/save_insert_del.asp method =&quot;POST&quot;
name=&quot;frm&quot;
style=&quot;border-style: solid;
border-width: 1px;
padding-left: 4px;
padding-right: 4px;
padding-top: 1px;
padding-bottom: 1px&quot;>
<TABLE id=fileinput0 width=&quot;876&quot;
bgcolor=&quot;#DDEEFF&quot;>
<tr>
<td width=&quot;9%&quot;
style=&quot;border-style: solid;
border-width: 1px&quot;
bgcolor=&quot;#FFFFFF&quot;>
<p align=&quot;center&quot;>类别</td>
<td width=&quot;11%&quot;
style=&quot;border-style: solid;
border-width: 1px&quot;
bgcolor=&quot;#FFFFFF&quot;>
<p align=&quot;center&quot;>物资名称</td>
<td width=&quot;11%&quot;
style=&quot;border-style: solid;
border-width: 1px&quot;
bgcolor=&quot;#FFFFFF&quot;>
<p align=&quot;center&quot;>规格型号</td>
<td width=&quot;9%&quot;
style=&quot;border-style: solid;
border-width: 1px&quot;
bgcolor=&quot;#FFFFFF&quot;>
<p align=&quot;center&quot;>计量单位</td>
<td width=&quot;9%&quot;
style=&quot;border-style: solid;
border-width: 1px&quot;
bgcolor=&quot;#FFFFFF&quot;>
<p align=&quot;center&quot;>税率</td>
<td width=&quot;11%&quot;
style=&quot;border-style: solid;
border-width: 1px&quot;
bgcolor=&quot;#FFFFFF&quot;>
<p align=&quot;center&quot;>数量</td>
<td width=&quot;9%&quot;
style=&quot;border-style: solid;
border-width: 1px&quot;
bgcolor=&quot;#FFFFFF&quot;>
<p align=&quot;center&quot;>不含税单价</td>
<td width=&quot;13%&quot;
style=&quot;border-style: solid;
border-width: 1px&quot;
bgcolor=&quot;#FFFFFF&quot;>
<p align=&quot;center&quot;>含税金额</td>
<td width=&quot;13%&quot;
style=&quot;border-style: solid;
border-width: 1px&quot;
bgcolor=&quot;#FFFFFF&quot;>
<p align=&quot;center&quot;>税额</td>
<td width=&quot;5%&quot;
style=&quot;border-style: solid;
border-width: 1px&quot;
bgcolor=&quot;#FFFFFF&quot;>
<p align=&quot;center&quot;>删除</td>
</tr>
</TABLE>
<% for i=0 to 9 %>
<table id=fileinput<%=i+1%> width=&quot;877&quot;
bgcolor=&quot;#DDEEFF&quot;>
<tr>
<td width=&quot;9%&quot;
bordercolor=&quot;#FFFFFF&quot;>
<select name=lb style=&quot;WIDTH:75;
height:19&quot;
onchange=&quot;MulSelect(1,<%=i%>)&quot;
tabindex=&quot;<%=i+2%>&quot;></select></td>
<td bgcolor=&quot;#FFFFFF&quot;
width=&quot;10%&quot;
bordercolor=&quot;#FFFFFF&quot;>
<select name=sname style=&quot;WIDTH:90;
height:19&quot;
onchange=&quot;MulSelect(2,<%=i%>)&quot;
tabindex=&quot;<%=i+2%>&quot;></select></td>
<td bgcolor=&quot;#FFFFFF&quot;
width=&quot;10%&quot;
bordercolor=&quot;#FFFFFF&quot;>
<select name=ggxh style=&quot;WIDTH:91;
height:19&quot;
onkeydown=&quot;return tabclick()&quot;
tabindex=&quot;<%=i+2%>&quot;></select></td>
<td bgcolor=&quot;#FFFFFF&quot;
width=&quot;8%&quot;
bordercolor=&quot;#FFFFFF&quot;>
<input type=&quot;text&quot;
name=&quot;a4&quot;
size=&quot;10&quot;
style=&quot;border=0;&quot;
onkeydown=&quot;return tabclick()&quot;
tabindex=&quot;<%=i+2%>&quot;></td>
<td bgcolor=&quot;#FFFFFF&quot;
width=&quot;9%&quot;
bordercolor=&quot;#FFFFFF&quot;>
<input type=&quot;text&quot;
name=&quot;a5&quot;
size=&quot;10&quot;
style=&quot;border=0;&quot;
onKeypress=&quot;return (/[/d.]/.test(String.fromCharCode(event.keyCode)))&quot;
onchange=get(<%=i%>) onkeydown=&quot;return tabclick()&quot;
tabindex=&quot;<%=i+2%>&quot;></td>
<td bgcolor=&quot;#FFFFFF&quot;
width=&quot;10%&quot;
bordercolor=&quot;#FFFFFF&quot;>
<input type=&quot;text&quot;
name=&quot;a6&quot;
size=&quot;12&quot;
style=&quot;border=0;&quot;
onchange=get(<%=i%>) onKeypress=&quot;
if (event.keyCode < 45 || event.keyCode > 57) event.returnValue = false;&quot;
onkeydown=&quot;return tabclick()&quot;
tabindex=&quot;<%=i+2%>&quot;></td>
<td bgcolor=&quot;#FFFFFF&quot;
width=&quot;9%&quot;
bordercolor=&quot;#FFFFFF&quot;><input type=&quot;text&quot;
name=&quot;a7&quot;
size=&quot;10&quot;
style=&quot;border=0;&quot;
onchange=get(<%=i%>) tabindex=&quot;<%=i+2%>&quot;></td>
<td bgcolor=&quot;#FFFFFF&quot;
width=&quot;12%&quot;
bordercolor=&quot;#FFFFFF&quot;><input type=&quot;text&quot;
name=&quot;a8&quot;
size=&quot;14&quot;
style=&quot;border=0;&quot;
onkeydown=&quot;return tabclick()&quot;
tabindex=&quot;<%=i+2%>&quot;></td>
<td bgcolor=&quot;#FFFFFF&quot;
width=&quot;13%&quot;
bordercolor=&quot;#FFFFFF&quot;><input type=&quot;text&quot;
name=&quot;a9&quot;
size=&quot;14&quot;
style=&quot;border=0;&quot;
onkeydown=&quot;return tabclick()&quot;
tabindex=&quot;<%=i+2%>&quot;></td>
<td bgcolor=&quot;#FFFFFF&quot;
width=&quot;5%&quot;
bordercolor=&quot;#FFFFFF&quot;><input type=button value=删除 class=cbutton OnClick=&quot;DelFileInput(<%=i+1%>)&quot;
onkeydown=&quot;return tabclick()&quot;
tabindex=&quot;<%=i+2%>&quot;></td>
</tr>
</TABLE>
<% next %>
<input type=&quot;button&quot;
name=&quot;add_line&quot;
value=&quot;增加下一行&quot;
OnClick=&quot;AddFileInput()&quot;
onkeydown=&quot;return tabclick()&quot;>
<script language=&quot;VBScript&quot;>
NowFileInputNo = 11
NowFileInputCount =10
idx=12
Sub AddFileInput()
HTMLSrc = &quot;<table id=fileinput&quot;&amp;NowFileInputNo&amp;&quot;
width=&quot;&quot;877&quot;&quot;
bgcolor=&quot;&quot;#DDEEFF&quot;&quot;><tr> <td width=&quot;&quot;9%&quot;&quot;
bordercolor=&quot;&quot;#FFFFFF&quot;&quot;><select name=lb style=&quot;&quot;WIDTH:75;
height:19&quot;&quot;
onchange=&quot;&quot;MulSelect(1,&quot;&amp;NowFileInputCount&amp;&quot;)&quot;&quot;
tabindex=&quot;&quot;&quot;&amp;idx&amp;&quot;&quot;&quot;></select></td><td bgcolor=&quot;&quot;#FFFFFF&quot;&quot;
width=&quot;&quot;10%&quot;&quot;
bordercolor=&quot;&quot;#FFFFFF&quot;&quot;><select name=sname style=&quot;&quot;WIDTH:90;
height:19&quot;&quot;
onchange=&quot;&quot;MulSelect(2,&quot;&amp;NowFileInputCount&amp;&quot;)&quot;&quot;
tabindex=&quot;&quot;&quot;&amp;idx&amp;&quot;&quot;&quot;></select></td>&quot;
HTMLSrc = HTMLSrc &amp;&quot;<td bgcolor=&quot;&quot;#FFFFFF&quot;&quot;
width=&quot;&quot;10%&quot;&quot;
bordercolor=&quot;&quot;#FFFFFF&quot;&quot;><select name=ggxh style=&quot;&quot;WIDTH:91;
height:19&quot;&quot;
onkeydown=&quot;&quot;return tabclick()&quot;&quot;
tabindex=&quot;&quot;&quot;&amp;idx&amp;&quot;&quot;&quot;></select></td>&quot;
HTMLSrc = HTMLSrc &amp;&quot;<td bgcolor=&quot;&quot;#FFFFFF&quot;&quot;
width=&quot;&quot;8%&quot;&quot;
bordercolor=&quot;&quot;#FFFFFF&quot;&quot;><input type=&quot;&quot;text&quot;&quot;
name=&quot;&quot;a4&quot;&quot;
size=&quot;&quot;10&quot;&quot;
style=&quot;&quot;border=0;&quot;&quot;
onkeydown=&quot;&quot;return tabclick()&quot;&quot;
tabindex=&quot;&quot;&quot;&amp;idx&amp;&quot;&quot;&quot;></td><td bgcolor=&quot;&quot;#FFFFFF&quot;&quot;
width=&quot;&quot;9%&quot;&quot;
bordercolor=&quot;&quot;#FFFFFF&quot;&quot;><input type=&quot;&quot;text&quot;&quot;
name=&quot;&quot;a5&quot;&quot;
size=&quot;&quot;10&quot;&quot;
style=&quot;&quot;border=0;&quot;&quot;
onKeypress=&quot;&quot;return (/[/d.]/.test(String.fromCharCode(event.keyCode)))&quot;&quot;
onchange=get(&quot;&amp;NowFileInputCount&amp;&quot;) onkeydown=&quot;&quot;return tabclick()&quot;&quot;
tabindex=&quot;&quot;&quot;&amp;idx&amp;&quot;&quot;&quot;></td>&quot;
HTMLSrc = HTMLSrc &amp;&quot;<td bgcolor=&quot;&quot;#FFFFFF&quot;&quot;
width=&quot;&quot;10%&quot;&quot;
bordercolor=&quot;&quot;#FFFFFF&quot;&quot;><input type=&quot;&quot;text&quot;&quot;
name=&quot;&quot;a6&quot;&quot;
size=&quot;&quot;12&quot;&quot;
style=&quot;&quot;border=0;&quot;&quot;
onchange=get(&quot;&amp;NowFileInputCount&amp;&quot;) onKeypress=&quot;&quot;
if (event.keyCode < 45 || event.keyCode > 57) event.returnValue = false;&quot;&quot;
onkeydown=&quot;&quot;return tabclick()&quot;&quot;
tabindex=&quot;&amp;idx&amp;&quot;></td>&quot;
HTMLSrc = HTMLSrc &amp;&quot;<td bgcolor=&quot;&quot;#FFFFFF&quot;&quot;
width=&quot;&quot;9%&quot;&quot;
bordercolor=&quot;&quot;#FFFFFF&quot;&quot;><input type=&quot;&quot;text&quot;&quot;
name=&quot;&quot;a7&quot;&quot;
size=&quot;&quot;10&quot;&quot;
style=&quot;&quot;border=0;&quot;&quot;
onchange=get(&quot;&amp;NowFileInputCount&amp;&quot;) tabindex=&quot;&quot;&quot;&amp;idx&amp;&quot;&quot;&quot;></td><td bgcolor=&quot;&quot;#FFFFFF&quot;&quot;
width=&quot;&quot;12%&quot;&quot;
bordercolor=&quot;&quot;#FFFFFF&quot;&quot;><input type=&quot;&quot;text&quot;&quot;
name=&quot;&quot;a8&quot;&quot;
size=&quot;&quot;14&quot;&quot;
style=&quot;&quot;border=0;&quot;&quot;
onkeydown=&quot;&quot;return tabclick()&quot;&quot;
tabindex=&quot;&quot;&quot;&amp;idx&amp;&quot;&quot;&quot;></td>&quot;
HTMLSrc = HTMLSrc &amp;&quot;<td bgcolor=&quot;&quot;#FFFFFF&quot;&quot;
width=&quot;&quot;13%&quot;&quot;
bordercolor=&quot;&quot;#FFFFFF&quot;&quot;><input type=&quot;&quot;text&quot;&quot;
name=&quot;&quot;a9&quot;&quot;
size=&quot;&quot;14&quot;&quot;
style=&quot;&quot;border=0;&quot;&quot;
onkeydown=&quot;&quot;return tabclick()&quot;&quot;
tabindex=&quot;&quot;&quot;&amp;idx&amp;&quot;&quot;&quot;></td><td bgcolor=&quot;&quot;#FFFFFF&quot;&quot;
width=&quot;&quot;5%&quot;&quot;
bordercolor=&quot;&quot;#FFFFFF&quot;&quot;><input type=button value=删除 class=cbutton OnClick=&quot;&quot;DelFileInput(&quot;&amp;NowFileInputNo&amp;&quot;)&quot;&quot;
onkeydown=&quot;&quot;return tabclick()&quot;&quot;
tabindex=&quot;&quot;&quot;&amp;idx&amp;&quot;&quot;&quot;></td></tr></TABLE>&quot;
HTMLSrc = HTMLSrc &amp;
vbcrlf
do
cument.all.add_line.InsertAdjacentHTML &quot;beforebegin
&quot;, HTMLSrc
Call MulSelect(0,NowFileInputCount)
idx=idx+1
NowFileInputNo = NowFileInputNo + 1
NowFileInputCount = NowFileInputCount + 1
End Sub
Sub DelFileInput(tableno)
do
cument.all(&quot;FileInput&quot;&amp;
tableno).outerHTML = &quot;&quot;
NowFileInputCount = NowFileInputCount - 1
End Sub
</script>
<script>
// 三级联动
var arrSel=[&quot;lb&quot;,&quot;sname&quot;,&quot;ggxh&quot;]
arrData=[];
// 从数据库中读出三级联动的数据, 保存到 arrData 数组中(二维数组)
<%
dim conn,rs
set conn = Server.CreateObject(&quot;ADODB.Connection&quot;)
conn.Open &quot;Provider=Microsoft.Jet.OLEDB.4.0;Data Source=&quot;
&amp;
Server.mappath(&quot;rktz/rktz.mdb&quot;) &amp;
&quot;;Persist Security Info=False&quot;
set rs=conn.execute(&quot;select * from spxx&quot;)
do while not rs.eof
%>
arrData[arrData.length]=[&quot;<%=trim(rs(&quot;lb&quot;))%>&quot;,&quot;<%=trim(rs(&quot;sname&quot;))%>&quot;,&quot;<%=trim(rs(&quot;ggxh&quot;))%>&quot;]
<%
rs.movenext
loop
rs.close:set rs=nothing
conn.close:set conn=nothing
%>
</script>
<script language=javascript >
//单价金额的级连函数
function get(h){
var m;
m=document.all.a5(h).value;
document.all.a8(h).value=document.all.a7(h).value*m*document.all.a6(h).value;
m=m-1;
document.all.a9(h).value=document.all.a7(h).value*m*document.all.a6(h).value}
function tabclick() {
if (window.event.keyCode==13) {
window.event.keyCode=9
}
}

// 下拉框选择变化时触发的函数,用于重新生成其下级下拉框
// num : 下拉框的级数, 1 表示最顶级
function MulSelect(num,k)
{
var i,j,arrTemp=[];
// 取得表单当前触发的下拉框的父级下拉框的值, 存放于 arrTemp 数组中(即不需要改变的值)
for(i=0;i<num;i++)
{
arrTemp=eval(&quot;document.frm.&quot;+arrSel)(k).value
}
if(num<arrSel.length)
{
// 对于触发下拉框的下一级的下拉框
with(eval(&quot;document.frm.&quot;+arrSel[num])(k))
{
// 先清空内容
length=0
// 对所有的记录遍历
for(i=0;i<arrData.length;i++)
{
var find=false
// 如果父级下拉框的记录不是当前选中的值,则跳过
for(j=0;j<num;j++)
{
if(arrTemp[j]!=arrData[j])
{
break;
}
}
if(j!=num)
{
continue;
}
// 这里已经可以保证第 i 项记录的数据属于当前选项的子数据
// 检查循环过程中是否已经添加了该选项,如果已有了, 则 fine = true
for(m=0;m<options.length;m++)
{
if(options[m].text==arrData[num])
{
find=true
}
}
// 若当前没有选项或者尚未添加该选项项,则添加之
if(length==0||!find)
{
options[options.length]=new Option(arrData[num],arrData[num])
}
}
// 递归调用生成下一级菜单的内容
MulSelect((num+1),k)
}
}
MulSelect(0,k+1)}
// 调用联动函数初始化下拉框
MulSelect(0,0)
</script>
<p><input type=&quot;submit&quot;
value=&quot;提交&quot;
name=&quot;B1&quot;><input type=&quot;reset&quot;
value=&quot;重置&quot;
name=&quot;B2&quot;></p>
</form>
</body>
</html>
 
数据表spxx:
sid na lb sname ggxh
1 MJ 日用品 毛巾 大
2 YS 日用品 牙刷 N11
3 ST 劳保 手套 J0小
4 XYF 劳保 洗衣粉 汰渍
5 LS 五金 螺丝 中号12
6 YX 随风倒地方 一洗 撒法
7 SJ 家电 手机 似的的
8 XYJ 家电 洗衣机 按时的
 
后退
顶部