| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1470 人关注过本帖
标题:求助asp列表框选择问题
取消只看楼主 加入收藏
放飞心情
Rank: 1
等 级:新手上路
帖 子:19
专家分:0
注 册:2005-6-10
收藏
 问题点数:0 回复次数:2 
求助asp列表框选择问题
图片附件: 游客没有浏览图片的权限,请 登录注册

如上图列表框里的项目是通过数据库按不同条件提取的,我图上选择的是"aaaaaaa"的用户,我想知道的是怎么才能把我选篮的那个用户提取出来
搜索更多相关主题的帖子: 列表框 选择问题 数据库 asp 
2005-08-18 16:27
放飞心情
Rank: 1
等 级:新手上路
帖 子:19
专家分:0
注 册:2005-6-10
收藏
得分:0 
具体点阿
2005-08-18 17:32
放飞心情
Rank: 1
等 级:新手上路
帖 子:19
专家分:0
注 册:2005-6-10
收藏
得分:0 

本页的源代码如下,我想做的是在列表框里选择1个用户时在本页提取出这个用户已经有的权限! <% opendb my ''联接数据库 Dim active,yhzmc,sql2,arrayLen,myArray dim kk,mm %> <html> <head> <SCRIPT LANGUAGE="JavaScript"> <!-- Begin var delimiter = "|"; function MoveOption (MoveFrom, MoveTo, ToDo) { var SelectFrom = eval('document.main_form.'+MoveFrom); var SelectTo = eval('document.main_form.'+MoveTo); var SelectedIndex = SelectFrom.options.selectedIndex; var container; if (ToDo=='Add') { container=eval('document.main_form.'+ToDo+MoveTo); } if (ToDo=='Remove') { container=eval('document.main_form.'+ToDo+MoveFrom); } if (SelectedIndex == -1) { alert("请选择一个用户"); } else { for (i=0; i<SelectFrom.options.length; i++) { if(SelectFrom.options[i].selected) { var name = SelectFrom.options[i].text; var ID = SelectFrom.options[i].value; SelectFrom.options[i] = null; SelectTo.options[SelectTo.options.length]=new Option (name,ID); i=i-1; if(ToDo=='Add'||ToDo=='Remove') { container.value=container.value+name+delimiter; } } } } //var xxx=document.main_form.Employees.value; // document.main_form.cc.value = xxx;

} function CheckDuplicates (AddListContainer, RemoveListContainer) { var AddList = eval('document.main_form.'+AddListContainer); var RemoveList = eval('document.main_form.'+RemoveListContainer); var TempAddList = AddList.value; var TempRemoveList = RemoveList.value; if (TempAddList>''&&TempRemoveList>'') { TempAddList = TempAddList.substring(0,TempAddList.length-1); TempRemoveList = TempRemoveList.substring(0,TempRemoveList.length-1); var AddArray = TempAddList.split(delimiter); var RemoveArray = TempRemoveList.split(delimiter); for (i=0; i<AddArray.length; i++) { for (j=0; j<RemoveArray.length; j++) { if (AddArray[i]==RemoveArray[j]) { AddArray[i]=''; RemoveArray[j]=''; break; } } } AddList.value=''; for (i=0; i<AddArray.length; i++) { if (AddArray[i]>'') { AddList.value = AddList.value + AddArray[i] + delimiter; } } RemoveList.value=''; for (i=0; i<RemoveArray.length; i++) { if (RemoveArray[i]>'') { RemoveList.value = RemoveList.value + RemoveArray[i] + delimiter; } } } } function LockChanges() { CheckDuplicates('AddAdmins','RemoveAdmins'); CheckDuplicates('AddUsers','RemoveUsers'); } // End --> function CheckSearch() { //var rq=Date(document.addForm.rq.value); if (document.searchForm.search[0].checked==true) { if (document.searchForm.sYhmqc.value=="") { alert("您已选择了按真实姓名查询,请填写真实姓名!"); return false; } }

if (document.searchForm.search[1].checked==true) { if (document.searchForm.syhm.value=="") { alert("您已选择了按用户名查询,请填写用户名!"); return false; } } if (document.searchForm.search[2].checked==true) { if (document.searchForm.sszdw.value=="") { alert("您已选择了按所在单位查询,请填写所在单位!"); return false; } }

if (document.searchForm.search[3].checked==true) { if (document.searchForm.sYhzmc.value=="") { alert("您已选择了按用户组名称查询,请填写用户组名称!"); return false; } } } </script> </head> <% search = request("search") 'response.write search %> <table ></div><tr><td bgcolor="#5794E4" colspan="3" ><font style="font-family: 宋体;font-size: 12pt;color:#333333">用户授权</font></td></tr><tr> <td width=1980 colspan="3"> </td></tr> <tr> <td align=left bgcolor="#C8DFFE" colspan="3">选择用户查找方式:</td> </tr>

<form method="POST" action="power_yhjzqx.asp" name="searchForm" onsubmit="return CheckSearch();"> <table border="0" width="100%" id="Table3" cellspacing="0" cellpadding="0"> <tr class="formtable"> <td>&nbsp;&nbsp; <input type="radio" name="search" value="chkyhmqc" ID="Checkbox1" > <input type="text" name="sYhmqc" size="10" ID="Text1" onFocus="if(this.value=='真实姓名')this.value='';" value="真实姓名" onclick="search[0].checked=true;">&nbsp;&nbsp;

<input type="radio" name="search" value="chkyhm" ID="Checkbox1" > <input type="text" name="syhm" size="10" ID="Text2" onFocus="if(this.value=='用户名')this.value='';" value="用户名" onclick="search[1].checked=true;">&nbsp;&nbsp;

<input type="radio" name="search" value="chkszdw" ID="Checkbox1"> <input type="text" name="sszdw" size="10" ID="Text3" onFocus="if(this.value=='所在单位')this.value='';" value="所在单位" onclick="search[2].checked=true;">&nbsp;&nbsp;

<input type="radio" name="search" value="chkYhzmc" ID="Checkbox1"> <% sql = "select * from sys_user01" Set rs2 = Server.CreateObject("Adodb.RecordSet") 'rs2.Open sql,conn,1,1 searchtable my,sql,rs2 ''查询数据库

response.Write "<select size='1' name='sYhzmc' class='tx1' onclick='search[3].checked=true;'>" response.Write "<option value=''>用户组名称</option>" do while not rs2.EOF response.Write "<option value='"+rs2("yhzmc")+"'>"+rs2("yhzbt")+"</option>" rs2.MoveNext loop response.Write "</select>" rs2.close set rs2=nothing %>&nbsp;&nbsp;

<input type="submit" value="查找" name="B1" ID="Submit1" class="button" > </td> </tr> </table> </form>

<table align="center"> <tr><td bgcolor="#C8DFFE"> <FORM name=main_form action="yhqx_indexsub.asp" method=post> <div align="center"> <table id="PurviewDetail" width="100%" border="0" cellspacing="1" cellpadding="14" >

<tbody>

<tr> <td valign="top" align="middle">您选择的授权用户<br> <!--select multiple size="12" name="Employees"--> <select multiple="true" size="12" name="Employees"> <% response.write search myArray = split(search,",",-1,1)

arrayLen = Ubound(myArray) response.write arrayLen if arrayLen<0 then sql = "select * from USER02_USER05 " else sql = "select * from USER02_USER05 where " sYhmqc = Trim(request("sYhmqc")) sYhm = Trim(request("sYhm")) sSzdw = Trim(request("sSzdw")) sYhzmc = Trim(request("sYhzmc")) for ii=0 to arrayLen 'response.write "******************"&trim(myArray(ii)) if trim(myArray(ii)) = "chkyhmqc" then 'response.write "^^^^^" if len(sql)<36 then sql = sql + " Yhmqc like '%"+sYhmqc+"%' " else sql = sql + " and Yhmqc like '%"+sYhmqc+"%' " end if

elseif trim(myArray(ii)) = "chkyhm" then if len(sql)<36 then sql = sql + " yhm like '%"+sYhm+"%' " else sql = sql + " and yhm like '%"+sYhm+"%'" ' sql="select * from user02_user05 where yhm like '%"+sYhm+"%' " end if

elseif trim(myArray(ii)) = "chkszdw" then if len(sql)<36 then sql = sql + " szdw like '%"+sszdw+"%' " else sql = sql + " and szdw like '%"+sszdw+"%' " 'sql="select * from user02_user05 where szdw like '%"+sszdw+"%' " end if

elseif trim(myArray(ii)) = "chkYhzmc" then if len(sql)<36 then sql = sql + " Yhzmc like '%"+sYhzmc+"%' " else sql = sql + " and Yhzmc like '%"+sYhzmc+"%' " 'sql="select * from user02_user05 where Yhzmc like '%"+sYhzmc+"%' " end if end if next end if response.write sql&"3333333"

Set rs = Server.CreateObject("Adodb.RecordSet") 'rs.Open sql,conn,1,1 searchtable my,sql,rs ''查询数据库 if not rs.eof then ''如果有这个调查记录 for i=1 to rs.recordcount gname=rs("yhm") gnameqm=rs("yhmqc") Response.Write("<option value="&gname&">"&gname&"["&gnameqm&"]</option>") rs.MoveNext next closetable rs end if %>

</td> </tr>

<tr> <td align=left colspan="3" bgcolor="#C8DFFE"> <!-- <table id="PurviewDetail" border="0" cellspacing="0" cellpadding="5" style="display:none" width="776" height="65">-->

<table border="0" cellpadding="0" cellspacing="0" id="table1" width="776" height="65"> <tr> <td valign="top" colspan="3">请选择授权目录:</td> <td width="73"></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td height="15"></td> </tr>

<tr> <td align="center"> 授权目录</td> <td colspan="3" align="center"> 授权目录ID</td> <td width="111" align="center"> 不可访问</td> <td align="center">只读</td> <td align="center"> 只写</td> <td align="center">可审核</td> <td align="center">可授权</td> <td height="15"></td> </tr> <% 'dim i i=1 sql="SELECT fcdid,jdmc,jdid FROM sys_web02 ORDER BY DECODE(FCDID,0,JDID,FCDID)||JDId" changetable my,sql,rs ''查询数据库 response.write " <input type=hidden name='ctlgCount' value=" & rs.recordcount & ">" DO while not rs.eof %> <tr>

<td align="left" colspan="2">&nbsp; <input style="border:0 none;; background-color:#C8DFFE" name=jdmc value=<%=rs("jdmc")%> > </td> <td align="left" colspan="2"> <input name="jdid_<%=i%>" value="<%=rs("jdid")%>" style="border:0 none;; background-color:#C8DFFE; text-align:center" size="11" ></td> <td align="center"><input type=radio name="checknum_<%=i%>" value=0 ></td> <td align="center" width="105">&nbsp;<input type=radio name="checknum_<%=i%>" value=1> </td> <td align="center" width="105"><input type=radio name="checknum_<%=i%>" value=2> </td> <td align="center" width="105"><input type=radio name="checknum_<%=i%>" value=3> </td> <td align="center" width="105"><input type=radio name="checknum_<%=i%>" value=4> </td> <td height="20"></td> </tr> <% i=i+1 rs.movenext loop closetable rs Response.Write("</td></tr>")%> <tr> <td valign="top" colspan="9">  </td> <td height="15" width="12"></td> </tr> </td></tr>

<tr> <td colspan="9" height="35" bgcolor="#C8DFFE"><p align="center"> <!--input name="cc" type=text type="hidden" size="11"--> <input onclick="LockChanges();" type="submit" value="提 交" name="B1" class="button" ID="Submit1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="reset" value="重 置" name="B2" class="button" ID="Reset1"></td> </tr></table> </form> <% 'end if closedb my%></body></html>

2005-08-19 15:48
快速回复:求助asp列表框选择问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.018613 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved