asp 我取下拉列表框选定值传到数据库时,为什么取出的是被选值的索引值,而不是选中的字符
代码如下:这段是动态增加行的js,下拉列表框在动态增加的行中,其中select是下拉列表框的name:
<script type="text/javascript">
var ii=0;
function addTable()
{
ii=ii+1;
var tab = document.getElementById("tb1") ;
//表格行数
var rows = tab.rows.length ;
if(rows<=8)
{
newTr=document.getElementById("tb1").insertRow();
var newTd0 = newTr.insertCell();
var newTd1 = newTr.insertCell();
var newTd2 = newTr.insertCell();
var newTd3 = newTr.insertCell();
var newTd4 = newTr.insertCell();
var newTd5 = newTr.insertCell();
var newTd6 = newTr.insertCell();
var newTd7 = newTr.insertCell();
var newTd8 = newTr.insertCell();
var newTd9 = newTr.insertCell();
var newTd10 = newTr.insertCell();
var newTd11 = newTr.insertCell();
var newTd12 = newTr.insertCell();
var newTd13 = newTr.insertCell();
var newTd14 = newTr.insertCell();
var newTd15 = newTr.insertCell();
newTd0.className='category';
newTd1.className='category';
newTd2.className='category';
newTd3.className='category';
newTd4.className='category';
newTd5.className='category';
newTd6.className='category';
newTd7.className='category';
newTd8.className='category';
newTd9.className='category';
newTd10.className='category';
newTd11.className='category';
newTd12.className='category';
newTd13.className='category';
newTd14.className='category';
newTd15.className='category';
newTd0.innerHTML="<img src='../images/folder_close.gif' style='cursor:hand' onClick='collapseall(this)'/>";
newTd1.innerHTML="<input name='xh"+tab.rows.length+"' id='xh"+tab.rows.length+"' type='text' size='5' value='' >";
switch(rows)
{
case 1:
newTd2.innerHTML="<%=ShowTable(2)%>"
break;
case 2:
newTd2.innerHTML="<%=ShowTable(3)%>"
break;
case 3:
newTd2.innerHTML="<%=ShowTable(4)%>"
break;
case 4:
newTd2.innerHTML="<%=ShowTable(5)%>"
break;
case 5:
newTd2.innerHTML="<%=ShowTable(6)%>"
break;
case 6:
newTd2.innerHTML="<%=ShowTable(7)%>"
break;
case 7:
newTd2.innerHTML="<%=ShowTable(8)%>"
break;
case 8:
newTd2.innerHTML="<%=ShowTable(9)%>"
break;
}
newTd3.innerHTML="<input name='fl"+tab.rows.length+"' id='fl"+tab.rows.length+"' type='text' size='8' value=''>"
newTd4.innerHTML="<input name='zbh"+tab.rows.length+"' id='zbh"+tab.rows.length+"' type='text' size='8' value=''>"
newTd5.innerHTML="<input name='gs"+tab.rows.length+"' id='gs"+tab.rows.length+"' type='text' size='8' onkeyup=\"$('je"+tab.rows.length+"').value=parseFloat($('dj"+tab.rows.length+"').value*this.value).toFixed(2)\"/>"
newTd6.innerHTML="<input name='dw"+tab.rows.length+"' id='dw"+tab.rows.length+"' type='text' size='8' value=''>"
newTd7.innerHTML="<input name='sl"+tab.rows.length+"' id='sl"+tab.rows.length+"' type='text' size='8' value=''>"
newTd8.innerHTML="<input name='xj"+tab.rows.length+"' id='xj"+tab.rows.length+"' type='text' size='8' value=''>"
newTd9.innerHTML="<input name='dj"+tab.rows.length+"' id='dj"+tab.rows.length+"' type='text' size='8' value='' >"
newTd10.innerHTML="<input name='je"+tab.rows.length+"' id='je"+tab.rows.length+"' type='text' size='8' value='' >"
newTd11.innerHTML="<input name='qxjxf"+tab.rows.length+"' id='qxjxf"+tab.rows.length+"' type='text' size='8' value=''>"
newTd12.innerHTML="<input name='gsf"+tab.rows.length+"' id='gsf"+tab.rows.length+"' type='text' size='8' value=''>"
newTd13.innerHTML="<input name='beizhu"+tab.rows.length+"' id='beizhu"+tab.rows.length+"' type='text' size='8' value=''>"
newTd14.innerHTML="<input name='hj"+tab.rows.length+"' id='hj"+tab.rows.length+"' type='text' size='8' onFocus=\"this.value=parseFloat($('je"+tab.rows.length+"').value)+parseFloat($('qxjxf"+tab.rows.length+"').value)+parseFloat($('gsf"+tab.rows.length+"').value)\"/>"
}
else
{
alert("对不起,此张料单最多只能开8笔!")
}
//alert(rows);
document.getElementById("num").value=rows;
}
</script>
<script>
function rdl_delRow(e){
event.cancelBubble=true;
with (event.srcElement.parentElement) {
if (tagName.toLowerCase()=="tr") tb1.deleteRow(rowIndex);
}
}
</script>
<%
Function ShowTable(Row)
StrTemp="<select size='1' name='select"&Row&"' id='select"&Row&"' onChange='fl"&Row&".value=this.options[select"&Row&".selectedIndex].fl"&Row&";zbh"&Row&".value=this.options[select"&Row&".selectedIndex].zbh"&Row&";dw"&Row&".value=this.options[select"&Row&".selectedIndex].dw"&Row&";sl"&Row&".value=this.options[select"&Row&".selectedIndex].sl"&Row&";xj"&Row&".value=this.options[select"&Row&".selectedIndex].xj"&Row&";dj"&Row&".value=this.options[select"&Row&".selectedIndex].dj"&Row&";qxjxf"&Row&".value=this.options[select"&Row&".selectedIndex].qxjxf"&Row&";gsf"&Row&".value=this.options[select"&Row&".selectedIndex].gsf"&Row&";beizhu"&Row&".value=this.options[select"&Row&".selectedIndex].beizhu"&Row&";'><option selected value=''></option>"
Set rs=Conn.execute("SELECT id,fl,zbh,dw,sl,xj,dj,qxjxf,gsf,mcjgg,beizhu FROM jgb Where mcjgg<>'' ORDER BY id ASC")
Do While Not rs.Eof
StrTemp=StrTemp&"<option value='"&rs("id")&"' fl"&Row&"='"&rs("fl")&"' zbh"&Row&"='"&rs("zbh")&"' dw"&Row&"='"&rs("dw")&"' sl"&Row&"='"&rs("sl")&"' xj"&Row&"='"&rs("xj")&"' dj"&Row&"='"&rs("dj")&"' qxjxf"&Row&"='"&rs("qxjxf")&"' gsf"&Row&"='"&rs("gsf")&"' beizhu"&Row&"='"&rs("beizhu")&"'> "&rs("mcjgg")&" </option> "
rs.MoveNext
Loop
rs.Close
Set rs=Nothing
StrTemp=StrTemp&"</select>"
ShowTable=StrTemp
End Function
%>
这段执行速度也很慢,请高手指教,下面是传值页面:
<%
num=request.Form("num")
'Response.Write Request.Form("select"&i)&"===="&Request.Form("num")
'Response.end
set rs=server.createobject("adodb.recordset")
sql="select * from kp"
rs.open sql,conn,1,3
for i=2 to num+1
rs.addnew
Response.Write Request.Form("select"&i)&"===="&Request.Form("fl2")
Response.end
rs("mcjgg")=Request.Form("select"&i)&""
rs("fl")=request.Form("fl"&i)&""
rs("zbh")=Request.Form("zbh"&i)&""
rs("gs")=Request.Form("gs"&i)&""
rs("dw")=Request.Form("dw"&i)&""
rs("sl")=Request.Form("sl"&i)&""
rs("xj")=Request.Form("xj"&i)&""
rs("dj")=Request.Form("dj"&i)&""
rs("je")=Request.Form("je"&i)&""
rs("qxjxf")=Request.Form("qxjxf"&i)&""
rs("gsf")=Request.Form("gsf"&i)&""
rs("beizhu")=Request.Form("beizhu"&i)&""
rs("hj")=Request.Form("hj"&i)&""
rs("yldw")=trim(request.Form("MajorName"))
rs("jz")=trim(request.Form("jz"))
rs("jh")=trim(request.Form("jh"))
rs("nr")=trim(request.Form("nr"))
rs("wtdw")=trim(request.Form("wtdw"))
rs("flr")=trim(request.Form("flr"))
rs("flrq")=trim(request.Form("startdate"))
rs("bh")=trim(request.Form("bh"))
rs("bh1")=trim(request.Form("bh1"))
rs("bi")=num
rs.Update
next
'response.Write(i&" ")
'response.Write(request.Form("je"&i)&"")
'Response.end
%>