http://www.51windows.net/hw/asp/jsview.asp?id=312
解决方案 »
- 急!点“提交”后,锁定整个页面,确认后刷新,怎么实现
- JSON 数组格式的不同,对远程 JS 获取的影响
- function addLoadEvent(func)这个函数什么意思
- 请高手指点 JS函数嵌套和传值问题
- 很棘手的一个问题,希望提供算法。
- 为什么不能向 文件输入框里设置 值 ?有什么解决的办法呢?
- 为什么
- 要救只能输入数字?整型数字?在1900-2004之间的整型数字?如何写?
- ◆告别CSDN,感谢朋友一直以来的支持!◆
- 为什么当变量赋值之后相同变量名的函数不会覆盖
- html页面里掉用vb做的active控件,msgbox正常弹出,但是printer打印时出现错误!!!
- 简单问题:如何动态调整通过form发送的量
function select1_dblclick(){
document.all.select2.add(document.all.select1.options[document.all.select1.selectedIndex]);
}
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<script language="javascript">
function LeftToRight(){
for(var i=left.length-1;i>=0;i--){
if(left.options[i].selected){
var op = document.createElement("OPTION");
op.text=left.options[i].text;
op.value=left.options[i].value;
right.add(op);
left.options[i] = null;
}
}
}
function RightToLeft(){
for(var i=right.length-1;i>=0;i--){
if(right.options[i].selected){
var op = document.createElement("OPTION");
op.text=right.options[i].text;
op.value=right.options[i].value;
left.add(op);
right.options[i] = null;
}
}
}
</script>
</HEAD>
<BODY>
<table>
<tr><td>
<SELECT NAME="left" size="10" multiple="true">
<option value="1">AAA</option>
<option value="2">BBB</option>
<option value="3">CCC</option>
<option value="4">DDD</option>
<option value="5">EEE</option>
</SELECT>
</td>
<td>
<table><tr><td>
<input type="button" value="--->" onclick="LeftToRight()"><br><br>
<input type="button" value="<---" onclick="RightToLeft()">
</td></tr></table>
</td><td>
<SELECT NAME="right" size="10" multiple="true" ></SELECT>
</td></tr></table>
</BODY>
</HTML>
<script language = 'JavaScript'>
var onecount;
onecount=0;
subcat = new Array();subcat[0] = new Array('1','A');
subcat[1] = new Array('2','B');
subcat[2] = new Array('3','C');
subcat[3] = new Array('4','D');
subcat[4] = new Array('5','E');
onecount = 5;
</script>
<html>
<head>
<title>
</title>
</head>
<body bgcolor="#efefef">
<table width="90%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td colspan="3" height="1" align=center background="../image/5-1_r11_c10.jpg"></td>
<td height="1">
</td>
</tr>
<tr bgcolor="#efefef">
<td width="200" height="1" align="left">
<select name="selectableIDList" multiple size="20" style="width:160; height:300" onDblClick="addConfirmer(); return false;">
</select>
</td>
<td bgcolor="#efefef" valign="middle">
<table>
<tr>
<td>
<img alt="" src="../image/R.gif" onclick="addConfirmer(); return false;" style="cursor: hand"/>add
</td>
</tr>
<tr>
<td>
<img alt="" src="../image/RR.gif" onclick="addAll(); return false;" style="cursor: hand"/>add all
</td>
</tr>
<tr>
<td height="5">
</td>
</tr>
<tr>
<td>
<img src="../image/L.gif" onclick="removeConfirmer(); return false;" style="cursor: hand"/>remove
</td>
</tr>
<tr>
<td>
<img src="../image/LL.gif" onclick="removeAll(); return false;" style="cursor: hand"/>remove all
</td>
</tr>
</table>
</td>
<td width="200" height="1" align="right">
<select name="selectedIDList" multiple size="20" style="width:160; height:300" onDblClick="removeConfirmer(); return false;">
</select>
</td>
<td valign=middle width="20" align="left">
<img alt="" src="../image/U.gif" onclick="moveUpDn(-1)" style="cursor: hand"/>up <br />
<img alt="" src="../image/D.gif" onclick="moveUpDn(1)" style="cursor: hand"/>down </td>
</tr>
<tr>
<td height="10" colspan="4">
</td>
</tr>
<tr>
<td colspan="3" align="center">
<a href="#" onclick="GetUsers()"><img src="../image/submit.gif" border=0></a>
<a href="#" onclick="removeAll(); return false;"><img src="../image/reset.GIF" border=0></a>
<a href="#" onclick="javascript:window.close();"><img src="../image/cancel.gif" border=0></a>
</td>
<td>
</td>
</tr>
</table>
<input type="hidden" name="selectedUsers"/>
<input type="hidden" name="selectedUsersID"/></body>
</html>
<script language = "JavaScript">
//carrier list
document.all.selectableIDList.length = 0;
var i;
var GetUsersID;
var GetSelectedUserID=""; for (i=0;i < onecount; i++)
{
document.all.selectableIDList.options[document.all.selectableIDList.length] = new Option (subcat[i][1],subcat[i][0]); }function addConfirmer() {
//select carrier
for (i = 0; i < document.all.selectableIDList.options.length; i++) {
if (document.all.selectableIDList.options(i).selected == true) {
j = document.all.selectedIDList.options.length - 1;
for (; j >= 0; j--) {
if (document.all.selectableIDList.item(i).value == document.all.selectedIDList.item(j).value) {
break;
}
}
if (j<0) {
newOpt = new Option(document.all.selectableIDList.item(i).text, document.all.selectableIDList.item(i).value);
document.all.selectedIDList.add(newOpt);
}
}
}
}
function addAll() {
//select all carrier
removeAll();
for (i = 0; i < document.all.selectableIDList.options.length; i++) {
//if (document.all.selectableIDList.options(i).selected == true) {
j = document.all.selectedIDList.options.length - 1; //if (j<0) {
newOpt = new Option(document.all.selectableIDList.item(i).text, document.all.selectableIDList.item(i).value);
document.all.selectedIDList.add(newOpt);
//}
//}
}
}
function removeConfirmer() {
//Delete selected carrier
myindex = -1;
for (i = document.all.selectedIDList.options.length - 1; i > myindex; i--) {
if (document.all.selectedIDList.options(i).selected == true) {
document.all.selectedIDList.remove(i);
} }}
function removeAll() {
//Delete selected carrier
myindex = -1;
for (i = document.all.selectedIDList.options.length - 1; i > myindex; i--) {
//if (document.all.selectedIDList.options(i).selected == true) {
document.all.selectedIDList.remove(i);
//} }}
function moveUpDn(direction) {
//Up or Down
myindex = 0;
for (; myindex < document.all.selectedIDList.options.length; myindex++) {
var text = document.all.selectedIDList.options(myindex).text;
if ( text.charAt(0) != '*'){
myindex--;
//if (myform.selectedIDList.options(myindex).value == myform.operatorID.value) {
break;
}
} if (myindex == document.all.selectedIDList.options.length) {
myindex = -1;
} index = document.all.selectedIDList.options.length;
count = 0;
for (i = document.all.selectedIDList.options.length - 1; i > myindex; i--) {
if (document.all.selectedIDList.options(i).selected == true) {
count++;
index = i;
}
}
if (count == 1) { // Select One only
if (direction < 0 && index > myindex + 1) { // Up
newOpt = new Option(document.all.selectedIDList.item(index).text, document.all.selectedIDList.item(index).value);
newOpt.selected = true;
document.all.selectedIDList.remove(index);
document.all.selectedIDList.add(newOpt, index + direction);
}
if (direction > 0 && index < document.all.selectedIDList.options.length - 1) { // Down
newOpt = new Option(document.all.selectedIDList.item(index).text, document.all.selectedIDList.item(index).value);
newOpt.selected = true;
document.all.selectedIDList.remove(index);
document.all.selectedIDList.add(newOpt, index + direction);
}
}
}</script>