<script language="javascript">
function lbl_Change()
{
document.form1.cpno.value=val;
document.form1.submit();
}
</script>
<form id="form4" name="zm" method="post" action="dhadd.asp">
<table width="720" height="30" border="1" align="center"
cellpadding="0" cellspacing="0" bordercolorlight=#cccccc
bordercolordark=#ffffff bgcolor=#f1f1f1>
<tr>
<td><div align="center">成品编码</div></td>
<td width="210"><div align="center">成品名称</div></td>
<td><div align="center">规格型号</div></td>
</tr>
<%
dim tg,exec,cg,exec1,cpRs,cpSql,cpName,cpType
exec="select cpno,cp_name,cp_type from cpht"
set tg=server.CreateObject("adodb.recordset")
cpSql="select cp_name,cp_type from cpht where cpno='"&Request.Form("cpno")&"'"
set cpRs=server.CreateObject("adodb.recordset")
tg.open exec,conn,1,1
cpRs.open cpSql,conn,1,1
IF cpRs.EOF Then
cpName=""
cpType=""
Else
cpName=cpRs("cp_name")
cpType=cpRs("cp_type")
End IF
cpRs.close
set cpRs=nothing
%>
<tr>
<td>
<select name="lb1" onChange="lbl_Change(this.options[this.selectedIndex].value);" size="1">
<option selected>请选择</option>
<%do while not tg.eof%>
<option value="<%=tg("cpno")%>"><%=tg("cpno")%></option>
<%
tg.movenext
loop
%>
</td>
</select>
<td><input type="text" name="cp_name" style="width:210px; text
-align:center" value="<%=cpName%>"></td>
<td><input type="text" name="cp_type" style="width:100px; text
-align:center" value="<%=cpType%>"></td>
</tr>
</table>
<input type="hidden" name="cpno" >
</form>
<%
tg.close
set tg=nothing
conn.close
set conn=nothing
%>
</body>
</html>
版主还是不行,运行后网上提示如下:
行:4
字符:4
错误:'val'未定义
代码:0