!!!请问 下面的javascript代码 如何实现 在列表框内 双击 列表中项目 实现两个列表框 项目数据 交换!(100分)

  • 主题发起人 主题发起人 wk0
  • 开始时间 开始时间
W

wk0

Unregistered / Unconfirmed
GUEST, unregistred user!
<script language="javascript">
function MoveSingleItem(sel_source, sel_dest)
{
if (sel_source.selectedIndex==-1) //源:没有点选任何项目
return;
if (sel_source.options[0].text=="无") //源:只有“无”项目
return;
if (sel_dest.options[0].text=="无") //目标:只有“无”项目,则先删除该提示性项目
sel_dest.options.remove(0);
var SelectedText = sel_source.options[sel_source.selectedIndex].text;
sel_dest.options.add(new Option(SelectedText));
sel_source.options.remove(sel_source.selectedIndex);
if (sel_source.options.length==0) //源:如果删除完所有有用项目,则添加提示项目:“无”
sel_source.options.add(new Option("无"));
}
function MoveAllItems(sel_source, sel_dest)
{
if (sel_source.options[0].text=="无") //源:只有“无”项目
return;
if (sel_dest.options[0].text=="无") //目标:只有“无”项目,则先删除该提示性项目
sel_dest.options.remove(0);
//首先拷贝所有项目到目标:
var sel_source_len = sel_source.length;
for (var j=0;
j<sel_source_len;
j++)
{
var SelectedText = sel_source.options[j].text;
sel_dest.options.add(new Option(SelectedText));
}
//然后删除“源”所有项目:
while ((k=sel_source.length-1)>=0)
{
if (sel_source.options[0].text=="无") //源:只有“无”项目
break;
sel_source.options.remove(k);
if (sel_source.options.length==0) //源:如果删除完所有有用项目,则添加提示项目:“无”
sel_source.options.add(new Option("无"));
}
}
function SelectAll(theSel) //选中select中全部项目
{ for (i = 0 ;i<theSel.length;i++)
theSel.options.selected = true;
}
</script>
<body>
<form name="frm1" id="frm1" method="post" action="save.asp">
<input name="allowsubmit" type="hidden" value="OK">
<table width="500" border="0" cellspacing="0" cellpadding="0" align="center">
<tr height=10><td colspan=3></td></tr>
<tr>
<td width="220" align=center valign="top">
已分配该用户管理的栏目:<br><br>
<select name="SelectedItem" id="SelectedItem" size=12 multiple="true">
<option>无</option>
</select>
</td>
<td width="80" align=center>
<br><br>
<button onClick="MoveSingleItem(WaitSelectItem, SelectedItem)">&amp;lt;</button><br><br>
<button onClick="MoveAllItems(WaitSelectItem, SelectedItem)">&amp;lt;&amp;lt;</button><br><br><br><br>
<button onClick="MoveSingleItem(SelectedItem, WaitSelectItem)">&amp;gt;</button><br><br>
<button onClick="MoveAllItems(SelectedItem, WaitSelectItem)">&amp;gt;&amp;gt;</button><br>
</td>
<td width="220" align=center valign="top">
待分配的栏目:<br><br>
<select name="WaitSelectItem" size=12 multiple=true>
<option >师大要闻</option>
<option >师大要闻2</option>
</select>
</td>
</tr>
</table>
</form>
 
前面代码 只能单击 按扭 来触发事件 ,本人想直接在列表里面 双击选项 产生 事件,如何办》? java大虾赐教
 
难道没有人知道吗??
 
我写了一个,你自己看看吧,不好意思,没分出来
<!-- #Include file="../../include/asp/create.Iasp" -->
<!-- #Include file="../../include/asp/checkright.Iasp" -->
<!-- #Include file="../../include/asp/opendatabase.Iasp" -->
<%CALL SaveHistoryWin("编辑招标供应商审核","编辑供应商审核")
BidSupplierID = Request("BidSupplierID")
SQL = "SELECT IsChkPass,ChkReason,"
SQL = SQL &amp;
"(SELECT SupplierCode FROM TSupplier WHERE SupplierID = a.SupplierID) SupplierCode,"
SQL = SQL &amp;
"(SELECT SupplierName FROM TSupplier WHERE SupplierID = a.SupplierID) SupplierName,"
SQL = SQL &amp;
"CASE WHEN IsDepositDone = 1 then
'<font color=red>是</font>' else
'否' END IsDepositDoneTxt,"
SQL = SQL &amp;
"CASE WHEN IsChkPass = 1 then
'通过' else
'<font color=red>未通过</font>' END IsChkPassTxt "
SQL = SQL &amp;
"FROM TBidSupplier a "
SQL = SQL &amp;
"WHERE BidSupplierID = " &amp;
BidSupplierID
'response.write sql
set rs=dbconn.execute (SQL)
SupplierCode=rs("SupplierCode") '供应商编号
SupplierName=rs("SupplierName") '供应商名字
IsChkPassTxt=rs("IsChkPassTxt") '是否通过审核
IsChkPass=rs("IsChkPass") '是否通过审核
ChkReason=HtmlEditCode(rs("ChkReason")) '审核意
IsDepositDoneTxt=rs("IsDepositDoneTxt") '是否已交押金
%>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html;
charset=gb2312">
<link rel="stylesheet" href="../../include/css/style.css" type="text/css">
<script src="../../include/js/public.js"></script>
<SCRIPT LANGUAGE="JavaScript">
<!--
function chkInput()
{
var obj=document.all
if(obj.IsChkPass[1].checked)
{
if(!chkNull(obj.ChkReason,'请填写评语!')) return false;
a.Frame.IsChkPass.value = obj.IsChkPass[1].value; a.Frame.ChkReason.value=obj.ChkReason.value;
}
else
{
a.Frame.IsChkPass.value = obj.IsChkPass[0].value;
a.Frame.ChkReason.value=obj.ChkReason.value;
}
a.Frame.BidSupplierID.value=<%=BidSupplierID%>;
return true
}
function getSelect(from,to)
{
fromList = eval('document.all.' + from);
toList = eval('document.all.' + to);
fromListLength=fromList.options.length;
for(i=0;i<fromListLength;i++)
{
toList.options=new Option('','');
toList.options.text = fromList.options.text;
}
}
var a = window.dialogArguments;
var mm = new Array(a,window);
//-->
</SCRIPT>
</head>
<body>
<table class="tb" border="1" cellSpacing="0" borderColorLight="#527DB5" BorderColorDark="#ffffff">
<tr>
<td>
<table class="tbsub3" border="1" cellSpacing="0" borderColorLight="#527DB5" BorderColorDark="#ffffff" width="100">
<tr>
<th colspan="4">供应商评价</th>
</tr>
<tr>
<td width="20%">供应商名称:</td>
<td width="30%" colspan=3><%=Rs("SupplierName")%></td>
</tr>
<tr>
<td width="20%">供应商编号:</td>
<td width="30%" colspan=3><%=Rs("SupplierCode")%></td>
</tr>
<tr>
<td>是否通过审核:</td>
<td width="85%" colspan="3">

<input class="select" type="radio" name="IsChkPass" value="1"
<%if IsChkPass="True" then
response.write "checked"%>>
&amp;nbsp;

<input name="IsChkPass" type="radio" class="select" value="0" <%if IsChkPass="False" then
response.write "checked"%> onclick="if(document.all.ChkReason.value==''){document.all.ChkReason.value='<%=replace(replace(ChkReason,chr(13),"/n"),chr(10),"/n")%>';}getSelect('notcheck2','notcheck')">
</td>
</tr>
<tr>
<td>审核意见:</td>
<td colspan="3"><textarea name="ChkReason" cols="30" rows="5"><%=ChkReason%></textarea>
<select size="5" name="notcheck" visible="false" style="width:170" multiple onDblClick="selectMore0('notcheck','ChkReason',false);">
<%
sql="select a.ParData as ParData from TChildParameter a,TParameter b"
sql=sql &amp;
" where a.ParID=b.ParID and b.ParCode='Par_Comment'"
set rs=dbconn.execute (sql)
do
while not rs.eof
%>
<option><%=rs("ParData")%></option>
<%
rs.movenext
loop
%>
</select>
<select size="5" name="notcheck2" visible="false" style="width:170" multiple onDblClick="selectMore0('notcheck','ChkReason',false);">
<%
sql="select a.ParData as ParData from TChildParameter a,TParameter b"
sql=sql &amp;
" where a.ParID=b.ParID and b.ParCode='Par_Comment'"
set rs=dbconn.execute (sql)
do
while not rs.eof
%>
<option><%=rs("ParData")%></option>
<%
rs.movenext
loop
%>
</select>
</td>
</tr>
<tr>
<td colspan="4" align="center">
<input class="button" type="button" name="Submit" value="确 定" onclick="if(chkInput()){ a.do_submit('document.all.Frame');window.close();}" >
&amp;nbsp;
<input class="button" type="button" name="back" value="关 闭" onclick="window.close();"></td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
<SCRIPT LANGUAGE="JavaScript">
function setselect(ok)
{
/* if (ok=='1'){
str='<br>';
if(!window.form1.upcount.value)
window.form1.upcount.value=1;
for(i=1;i<=window.form1.upcount.value;i++)
str+='照片'+i+':<input type="file" name="file'+i+'" style="width:400" class="tx1"><br><br>';
window.upid.innerHTML=str+'<br>';
}
}*/
}
//-->
</SCRIPT>
<!-- #Include file="../../include/asp/closedatabase.Iasp" -->
<SCRIPT LANGUAGE="JavaScript">
<!--
document.onkeydown = closeWin;
document.all.notcheck2.style.display='none';
//-->
</SCRIPT>
 
多谢大虾!以后还望 不吝赐教!
 
后退
顶部