急~急~~急,高手请进,分不够在加

qfacy 2004-09-24 12:38:34
我想做一个会议系统,在添加会议人员我想用互传的方式来选择
思想如下:
但是遇到的问题是
人员检索 |请选择部门|--->下拉框
-------------------------------------
| |
区域1 |-移动->| 区域2
对应显示 | |显示参加
部门的人 | |会议的人
|<-移动-|
| |
参加会议的人可能有很多部门,比如:研发部(包含2个人1、2),市场部(包
含两个人3、4)两个部门。
当我选择研发部时,区域1显示这个部门所有人的名字,我选择1在点移动时1
的名字进入区域2,在选市场部门,同研发部门一样,我选择3,这时3进入
区域2,这时问题出现了!程序运行的结果是区域2只有3这个人,而1这个人
自动消失了!
我想问的是,如何来保存已经进入区域2的的名字?
下拉菜单我用
<select name="select1" onchange="document.form.submit()">语句来刷!
区域2我用
<select name="sltEmp" multiple size="6" style="width=100%">

</select>
来记录,我不知道如何写区域2(下拉匡)代码来保存上的部门已经选择的人!
...全文
128 14 打赏 收藏 转发到动态 举报
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
qfacy 2004-09-24
  • 打赏
  • 举报
回复
兄弟,你这个我已经实现了!
我问的是:
当我选择研发部时,区域1显示这个部门所有人的名字,我选择1在点移动时1
的名字进入区域2,在选市场部门,同研发部门一样,我选择3,这时3进入
区域2,这时问题出现了!程序运行的结果是区域2只有3这个人,而1这个人
自动消失了!
我想问的是,如何来保存已经进入区域2的的名字?
whnnet 2004-09-24
  • 打赏
  • 举报
回复
http://lucky.myrice.com/javascriptexam/add_del_Select.htm
whnnet 2004-09-24
  • 打赏
  • 举报
回复
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="JavaScript">
<!--
function addSrcToDestList() {
destList = window.document.forms[0].destList;
srcList = window.document.forms[0].srcList;
var len = destList.length;
for(var i = 0; i < srcList.length; i++) {
if ((srcList.options[i] != null) && (srcList.options[i].selected)) {

var found = false;
for(var count = 0; count < len; count++) {
if (destList.options[count] != null) {
if (srcList.options[i].text == destList.options[count].text) {
found = true;
break;
}
}
}
if (found != true) {
destList.options[len] = new Option(srcList.options[i].text);
len++;
}
}
}
}

function deleteFromDestList() {
var destList = window.document.forms[0].destList;
var len = destList.options.length;
for(var i = (len-1); i >= 0; i--) {
if ((destList.options[i] != null) && (destList.options[i].selected == true)) {
destList.options[i] = null;
}
}
}
// -->
</SCRIPT>
</head>
<body>
<center>
<form method="POST">
<table bgcolor="#FFFFCC">

<tr>
<td bgcolor="#FFFFCC" width="85">
<select size="6" name="srcList" multiple>
<option value="1">Item 1
<option value="2">Item 2
<option value="3">Item 3
<option value="4">Item 4
<option value="5">Item 5
<option value="6">Item 6
</select>
</td>
<td bgcolor="#FFFFCC" width="74" align="center">
<input type="button" value=" 增加到右边 " onClick="javascript:addSrcToDestList()">
<br><br>
<input type="button" value=" 从右边删除 " onclick="javascript:deleteFromDestList();">
</td>
<td bgcolor="#FFFFCC" width="69">
<select size="6" name="destList" multiple>
</select>
</td>
</tr>
</table>
</form>
</body>
</html>
whnnet 2004-09-24
  • 打赏
  • 举报
回复
http://dotnet.aspx.cc/Exam/Tree.zip
yyyjff 2004-09-24
  • 打赏
  • 举报
回复
高手太多 闪
yyyjff 2004-09-24
  • 打赏
  • 举报
回复
帮忙up
yb2008 2004-09-24
  • 打赏
  • 举报
回复
zltostem(尘寞)的方法不错!
zltostem 2004-09-24
  • 打赏
  • 举报
回复
这个可以吗~~~

<script language="javascript">
<!--
var a1 = new Array('张三','李四');
var a2 = new Array('王五','赵六');
var i;
function window.onload()
{
var s = document.all.s1;
for(i=0;i<a1.length;i++)
{
s.options.add(new Option(a1[i],''));
}
}

function change(x)
{
var s = document.all.s1;
var a = 'a'+x;
var op;
s.length = 0;
for(i=0;i<a.length;i++)
{
op = eval('a'+x)[i];
s.options.add(new Option(op,''));
}
}

function move(obj1,obj2)
{
o1 = document.all(obj1);
o2 = document.all(obj2);
if(o1.length == 0)
{
//
}
else
{
for(var i=o1.length-1;i>=0;i--)
{
if(o1[i].selected)
{
o2.options.add(new Option(o1.options[i].text,o1.options[i].value));
o1.remove(i);
}
}
}
}
//-->
</script>

<select onchange="change(this.value);">
<option value=1>部门一
<option value=2>部门二
</select><p>
<select name=s1 size=5 multiple>
</select>
<input type=button value=移动→ onclick="move('s1','s2')">
<input type=button value=←移动 onclick="move('s2','s1')">
<select name=s2 size=5 multiple>
</select>


englvr 2004-09-24
  • 打赏
  • 举报
回复
common.asp、conn.asp中,我只用了一个连接字串和一些界面相关的函数,没什么用

基本思路是这样:
1.conference表
新建会议,生成一条记录,并获得会议ID,然后转入添加人员界面

2.user表 和 conference_person表
通过"所设计的界面",实现把user表中需要开会的人员添加到conference_person表,并确定会议ID

这样,两个列表框只需要分别读出user表(不含已被添加的人员)和conference_person表的内容即可


qfacy 2004-09-24
  • 打赏
  • 举报
回复
回复人: zltostem(尘寞) ( ) 信誉:106
你好!
刚刚我表达可能不是很清楚!我想要的效果是!
部门是通过<select>选择,部门选择后在区域1里显示这个部门的所有人!移动这个部门参加会议人后!
我又要通过<select>选择另外一个部门,这时候上步的操作就完全不起作用了!
也就是说,我选择的参加会议的人只能是一个部门的!
zltostem 2004-09-24
  • 打赏
  • 举报
回复
<script language="javascript">
<!--
function move(obj1,obj2)
{
o1 = document.all(obj1);
o2 = document.all(obj2);
if(o1.length == 0)
{
//
}
else
{
for(var i=o1.length-1;i>=0;i--)
{
if(o1[i].selected)
{
o2.options.add(new Option(o1.options[i].text,o1.options[i].value));
o1.remove(i);
}
}
}
}
//-->
</script>

<select name=s1 size=5 multiple>
<option>张三
<option>李四
</select>
<input type=button value=移动→ onclick="move('s1','s2')">
<input type=button value=←移动 onclick="move('s2','s1')">
<select name=s2 size=5 multiple>
<option>王五
<option>赵六
</select>
qfacy 2004-09-24
  • 打赏
  • 举报
回复
zhaofengwj@sina.com.cn
邮箱写错了!
qfacy 2004-09-24
  • 打赏
  • 举报
回复
回复人: englvr() ( ) 信誉:100
兄弟,能不能把把common.asp、conn.asp和数据库给我一份!
这个问题,我真是没有头绪!
zhaofengwj@sian.com.cn
先谢谢你了!问题解决了,我另开帖子在给分
englvr 2004-09-24
  • 打赏
  • 举报
回复
这是我在某个项目上做的,和你的要求十分类似(多了个“机构”选择),你研究一下吧。

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="inc/common.asp" -->
<!--#include file="inc/conn.asp" -->
<%
checkuser

dim source_user_table
dim source_user_index_field
dim source_user_name_field
source_user_table = "employee"
source_user_index_field = "id"
source_user_name_field = "name"

dim des_user_table
dim des_user_index_field
des_user_table = "har_content"
des_user_index_field = "add_person_id"

dim des_where_field
dim des_where_result
des_where_field = "cus_id"
des_where_result = request.QueryString("id")

dim depid
if request.Form("depid")<>"" then
depid = request.Form("depid")
else
depid = 0
end if

%>
<html>
<head>
<title>harlist</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="css/style.css" rel="stylesheet" type="text/css">
<script language="JScript">
function postform(action)
{
var o_hidden_action = document.getElementById("hidden_action");
o_hidden_action.value = action;

var o_form_select = document.getElementById("form_select");
o_form_select.submit();
}
function changebranchset()
{
var o_td_dep = document.getElementById('td_dep');
var o_select_bid = document.getElementById('bid');
var s, ss, key, str;
str = '';
ss = o_select_bid.options(o_select_bid.selectedIndex).id.split('|');
if (ss != "")
{
for (key in ss)
{
s = ss[key].split(',');
str = str + '<option value="'+s[1]+'">' + s[0] + '</option>';
}
}
str = '选择部门 <select name="depid" onChange="postform(\'\')"><option value="0">无</option>' + str + '</select>'
o_td_dep.innerHTML = str;

}
</script>
</head>
<%
dim rs, conn
Set conn = Server.CreateObject("ADODB.Connection")
conn.open ConnectStr

if request.Form("action") = "add" and request.Form("user_l")<>"" then
conn.execute("insert into "&des_user_table&" ("&des_user_index_field&","&des_where_field&", add_person_depid) select "&source_user_index_field&","&des_where_result&","&depid&" from "&source_user_table&" where "&source_user_index_field&" in("&request.Form("user_l")&")")
elseif request.Form("action") = "del" and request.Form("user_r")<>"" then
conn.execute("DELETE FROM "&des_user_table&" WHERE "&des_user_index_field&" in("&request.Form("user_r")&") and "&des_where_field&"="&des_where_result)
else
end if

Call header("添加人员",100)
%>
<table cellspacing="0" cellpadding="0" border="1" align=center width="97%">
<tr>
<td>
<form id="form_select" action="harlist.asp?id=<%response.Write(request.QueryString("id"))%>" method="post">
<table cellspacing="0" cellpadding="3" border="0" align=center width="100%" bgcolor="#D6D3CE">
<tr height="20">
<td class="tabletitle">
选择机构 <select name="bid" id="bid" onChange="changebranchset()">
<option value="0">无</option>
<%
dim edit_rs, bid
Set edit_rs = conn.execute("select bid from department where id="&depid)
if not (edit_rs.EOF and edit_rs.BOF) then
bid = edit_rs.fields("bid")
else
bid = 0
end if
edit_rs.Close()
Set edit_rs=nothing

Set rs = conn.execute("select id, name, dbo.getdepstr(id) as dep from branchset order by id asc")
if not (rs.EOF and rs.BOF) then
rs.MoveFirst
while not rs.EOF

if bid=rs.Fields("id") then
%>
<option value="<%response.Write(rs.Fields("id"))%>" id="<%response.Write(rs.Fields("dep"))%>" selected><%response.Write(rs.Fields("name"))%></option>
<%
else
%>
<option value="<%response.Write(rs.Fields("id"))%>" id="<%response.Write(rs.Fields("dep"))%>"><%response.Write(rs.Fields("name"))%></option>
<%
end if

rs.MoveNext
wend
end if
rs.Close()
Set rs = Nothing
%>
</select>
</td>
<td class="tabletitle" id="td_dep">
选择部门 <select name="depid" onChange="postform('')">
<option value="0">无</option>
<%
Set rs = conn.execute("select id, name from department where bid="&bid)
if not (rs.Bof and rs.Eof) then
rs.MoveFirst()
while not rs.Eof

if CInt(depid)=CInt(rs.Fields("id")) then
%>
<option value="<%response.Write(rs.Fields("id"))%>" selected><%response.Write(rs.Fields("name"))%></option>
<%
else
%>
<option value="<%response.Write(rs.Fields("id"))%>"><%response.Write(rs.Fields("name"))%></option>
<%
end if

rs.MoveNext
wend
end if
rs.Close()
Set rs = nothing
%>
</select>
</td>
</tr>
</table>
</td>
</tr>
</table>
<br>
<input type="hidden" id="hidden_action" name="action">
<table cellspacing="0" cellpadding="0" border="1" align=center width="97%">
<tr>
<td>
<table cellspacing="1" cellpadding="3" align=center style="width:100%;border: 1px; background-color: #AAAAAA;">
<th height="20" style="background-color: #D6D3CE;" colspan="3">
</th>
</tr>
<tr style="background-color: #EEEEEE;">
<td class="tabletitle">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr height="20">
<td class="tabletitle">待选员工:</td>
<td class="tabletitle"></td>
<td class="tabletitle">已选员工:</td>
</tr>
<tr>
<td align="center">
<%
response.Write("<select name=""user_l"" multiple size=""10"" style=""height:188px;width:183px"">")
Set rs = conn.execute("select "&source_user_index_field&","&source_user_name_field&" from "&source_user_table&" where status = 1 and "&source_user_index_field&" in (select userid from empduty where depid="&depid&") and "&source_user_index_field&" not in (select "&des_user_index_field&" from "&des_user_table&" where "&des_where_field&"="&des_where_result&")")
if not (rs.BOF and rs.EOF) then
rs.MoveFirst
while not rs.EOF
response.Write(vbCrLf &"<option value="""&rs.Fields(0)&""">"&rs.Fields(1)&"</option>")
rs.MoveNext
wend
end if
rs.Close
Set rs = Nothing
response.Write(vbCrLf &"</select>")
%>
</td>
<td align="center">
<p><input type="button" value="添加->" onClick="postform('add')"></p>
<p><input type="button" value="删除<-" onClick="postform('del')"></p>
</td>
<td align="center">
<%
response.Write("<select name=""user_r"" multiple size=""10"" style=""height:188px;width:183px"">")
Set rs = conn.execute("select "&source_user_table&"."&source_user_index_field&","&source_user_table&"."&source_user_name_field&" from "&des_user_table&","&source_user_table&" where "&des_user_table&"."&des_where_field&"="&des_where_result&" and "&source_user_table&"."&source_user_index_field&"="&des_user_table&"."&des_user_index_field)
if not (rs.BOF and rs.EOF) then
rs.MoveFirst
while not rs.EOF
response.Write(vbCrLf &"<option value="""&rs.Fields(0)&""">"&rs.Fields(1)&"</option>")
rs.MoveNext
wend
end if
rs.Close
Set rs = Nothing
response.Write(vbCrLf &"</select>")
%>
</td>
</tr>
</table>
</td>
</tr>
<th height="20" style="background-color: #D6D3CE;" colspan="3">
<input type="button" value="返回" onClick="window.location.href='harmonyannc.asp?mode=edit&id=<%response.Write(request.QueryString("id"))%>'">
</th>
</table>
</td>
</tr>
</table>
</form>
<%
conn.Close
Set conn = Nothing
%>
</body>
</html>

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧