改变输出方式...
程序代码:
<!--#include file="conn.asp"--> <style type="text/css"> <!-- .STYLE4 {font-size: 20px} BODY{FONT-SIZE: 12px;} --> </style> <% dim count rs3.open"select name from person",conn,1,1 %> <script language="JavaScript"> var onecount; onecount=0; subcat = new Array(); <% count = 0 do while not rs3.eof %> subcat[<%=count%>] = new Array("<%= left(trim(rs3("name")),1)%>","<%= trim(rs3("name"))%>","无"); <% count = count + 1 rs3.movenext loop call rs3close() 'call connclose() %> onecount=<%=count%>; function keydown(xueyuan) { document.ftiwen.BoardClass.length = 0; var i; for (i=0;i < onecount; i++) { if (subcat[i][0] == xueyuan) { //document.getElementById("dd2").options[document.getElementById("dd2").length] = new Option(subcat[i][1]); // document.getElementById("xue").value=new Option(subcat[i][1]); // document.getElementById("xue").div.innerHTML.=new div(subcat[i][1]); //document.all.xue.innerHTML = new Li(subcat[i][1]); //document.ff.gudingzhi.value=subcat[i][1]; //document.getElementById(dd).value=subcat[i][1]; document.ftiwen.BoardClass.options[document.ftiwen.BoardClass.length] = new Option(subcat[i][1]); } //else //{ // document.ff.gudingzhi.value=""; //} } } </script> <body> <form name=ftiwen action="index.asp" type="post"> <table> <tr> <td align="right">学员姓名:</td><td><input type=text name=xueyuan onKeyUp="keydown(this.value);" > <div id=xue> </div> </td> </tr> <tr> <td align="right"><span class="STYLE4">学员姓名:</span></td><td> <SELECT name="BoardClass" size="8" style="WIDTH: 90px" > <OPTION selected value>==请选择小类==</OPTION> </SELECT> </td> </tr> <tr> <td align="center" colspan="5"><input type=submit name=submit id=submit value=取值 class=bnsrh></td> </tr> </table> </form> </body> conn.asp <% session.timeout=60 set conn=server.createobject("adodb.connection") on error resume next conn.open"provider=microsoft.jet.oledb.4.0;data source="&server.mappath("aa.mdb") set rs=server.createobject("adodb.recordset") set rs1=server.createobject("adodb.recordset") set rs2=server.createobject("adodb.recordset") set rs3=server.createobject("adodb.recordset") set rs4=server.createobject("adodb.recordset") 'if err then 'Err.Clear ' conn.close '' set conn=nothing ' Response.Write "数据库连接出错,请打开conn.asp文件检查连接字串。" ' Response.End 'end if sub rsclose() rs.close set rs=nothing end sub sub rs1close() rs1.close set rs1=nothing end sub sub rs3close() rs3.close set rs3=nothing end sub sub connclose() conn.close set conn=nothing end sub %>
输入数据库 aa.mdb
person
如何 在输入 陈 后,,
学生姓名 在 <div id=xue>
</div>显示,和点击后,将值给 xueyuan 输入框
[ 本帖最后由 ysf0181 于 2010-7-9 11:21 编辑 ]