This Domain(Admin5.com) is for Sale:

用Javascript 实现的Dual listbox

时间:2007-12-27  来源:不详  作者:林子
这是我用 javascript 制作的“Dual listbox”(双向选择器)的一个应用示例,是从我的代码中抠出来的。在网页编程中经常会用到。

也许我的实现太烦琐了,希望大家有更好的代码贡献出来。 织梦好,好织梦

<html>
<head>
<title>选择器</title>
<link href="./style/style.css" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta http-equiv="Page-Enter" content="blendTrans(Duration=1.0)">
<meta http-equiv="Page-Exit" content="blendTrans(Duration=1.0)">
<script language="javascript">
function openwin(url, l, t, w ,h)
{open(url,'','toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=' w ',height=' h ',left=' l ',top=' t);} 本文来自织梦

function check_and_submit(frm)
{
SelectAll(frm.SelectedItem);
frm.submit();
}
</script>
</head>

织梦好,好织梦

<body>

织梦内容管理系统

<form name="frm1" id="frm1" method="post" action="save.asp">
<input name="allowsubmit" type="hidden" value="OK">

copyright dedecms

<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>

dedecms.com

<select name="SelectedItem" id="SelectedItem" size=12 multiple="true">
<option>无</option>

织梦内容管理系统

</select>
</select>
</td>
<td width="60" align=center>
<br><br>
<button onClick="MoveSingleItem(WaitSelectItem, SelectedItem)">&lt;</button><br><br>
<button onClick="MoveAllItems(WaitSelectItem, SelectedItem)">&lt;&lt;</button><br><br><br><br>
<button onClick="MoveSingleItem(SelectedItem, WaitSelectItem)">&gt;</button><br><br>
<button onClick="MoveAllItems(SelectedItem, WaitSelectItem)">&gt;&gt;</button><br>
</td>
<td width="220" align=center valign="top">
待分配的栏目:<br><br>
<select name="WaitSelectItem" size=12 multiple=true>
<option>师大要闻</option>
<option>视频新闻</option>
<option>图片新闻</option>
<option>专题要闻</option>
<option>十万个为什么</option>
<option>代码测试</option> copyright dedecms
<option>www.why100000.com</option>
</select>
</td>
</tr>
</table>
</form> 本文来自织梦

<script language="javascript">
function MoveSingleItem(sel_source, sel_dest)
{
if (sel_source.selectedIndex==-1) file://源:没有点选任何项目
return;

内容来自dedecms

if (sel_source.options[0].text=="无") file://源:只有“无”项目
return; 内容来自dedecms


if (sel_dest.options[0].text=="无")

看完这篇,您有何感觉呢?

文章评论

共有位Admini5网友发表了评论 查看完整内容

24小时热门信息