我用onchange()把hwselecttext(数据库的内容'1、2、3、4、5')传递过去,为什么总是报'1、2、3、4、5'未定义错误。

cnqj_cn 2009-08-09 04:17:36
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Connections/conn.asp" -->
<%
Dim Recordset1
Dim Recordset1_numRows

Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_conn_STRING
Recordset1.Source = "SELECT * FROM menu_bzaj_dw"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()

Recordset1_numRows = 0
%>
<%
Dim Recordset2
Dim Recordset2_numRows

Set Recordset2 = Server.CreateObject("ADODB.Recordset")
Recordset2.ActiveConnection = MM_conn_STRING
Recordset2.Source = "SELECT * FROM menu_bzaj_dw1"
Recordset2.CursorType = 0
Recordset2.CursorLocation = 2
Recordset2.LockType = 1
Recordset2.Open()

Recordset2_numRows = 0
dim hwselecttext
do while not recordset2.eof
hwselecttext=hwselecttext+recordset2(0)
recordset2.movenext
loop
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<script language="javascript">
function change_menu (x)
{
document.form1.select2.length=5;
document.form1.select2.options(0).text=x;
}
</script>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档 </title>
</head>

<body>
<form id="form1" name="form1" method="post" action="">
<label>
<select name="select" onchange="change_menu( <%=hwselecttext%>)">
<%
While (NOT Recordset1.EOF)
%>
<option value=" <%=(Recordset1.Fields.Item("dw").Value)%>"> <%=(Recordset1.Fields.Item("dw").Value)%> </option>
<%
Recordset1.MoveNext()
Wend
If (Recordset1.CursorType > 0) Then
Recordset1.MoveFirst
Else
Recordset1.Requery
End If
%>
</select>
</label>
<label>
<select name="select2">
</select>
</label>
</form>
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>
<%
Recordset2.Close()
Set Recordset2 = Nothing
%>

我用onchange()把hwselecttext(数据库的内容'1、2、3、4、5')传递过去,为什么总是报'1、2、3、4、5'未定义错误。
希望那位大哥帮我解决,感激不尽.
...全文
18 点赞 收藏 3
写回复
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
cnqj_cn 2009-08-09
谢谢.
回复
toury 2009-08-09
<select name="select" onchange="change_menu('<%=hwselecttext%>')">
回复
hookee 2009-08-09
onchange="change_menu('<%=hwselecttext%>');">
回复
发动态
发帖子
ASP
创建于2007-09-28

2.8w+

社区成员

ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
申请成为版主
社区公告
暂无公告