日期:2014-05-17 浏览次数:20832 次
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <% Dim conn Sub connect On Error Resume Next Set Conn=Server.CreateObject("ADODB.Connection") Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&Server.MapPath("db.mdb") If Err.Number<>0 Then Response.Write "数据库连接发生错误" : Response.End() End sub connect '链接数据库 %> <script language="javascript"> function CheckAll(form){ for (var i=0;i<form.elements.length;i++){ var e = form.elements[i]; if (e.name != 'chkall') e.checked = form.chkall.checked; } } </script> <html> <head> </head> <body> <form name="form1"> <select name="searchid" id="searchid" onchange="redirect()"> <option value="0">请选择</option> <% Sql = "Select * from jilian where pid=0 order by id desc" set rs = conn.execute(sql) do while not rs.eof %> <option value="<%=rs("id") %>"><%=rs("name") %></option> <% rs.movenext loop rs.close set rs=nothing %> </select> <select name="type2" id="type2"> <option value="0">请选择</option> </select> </form> <script> function redirect(){ var x=document.getElementById("searchid").value; var i i=0 var temp=document.form1.type2 <% set rs2=server.CreateObject("adodb.recordset") sql2="select * from jilian" rs2.open sql2,conn,1,3 while not rs2.eof %> cnt=<%=rs2("pid")%> if(cnt==x) { if(x!=0){ temp.options[i+1]=new Option('<%=rs2("name") %>','<%=rs2("id")%>') i=i+1 }else{ temp.remove(i+1); } } <% rs2.movenext wend %> } </script> </body> </html>