<from><input type="text" name="s1" id="s1"> <select name="select">
<option>1</option>
<option>2</option>
<option>3</option>
</select>
<input type="button" onclick="copy()" value="copy"> <input type="text" name="s2" id="s2"><select name="select">
<option>1</option>
<option>2</option>
<option>3</option>
</select></form>
本人QQ:578787044
<option>1</option>
<option>2</option>
<option>3</option>
</select>
<input type="button" onclick="copy()" value="copy"> <input type="text" name="s2" id="s2"><select name="select">
<option>1</option>
<option>2</option>
<option>3</option>
</select></form>
本人QQ:578787044
解决方案 »
- 全选复选按钮
- 关于sina editor的问题
- ********** 为什么radio只有一个的时候,js取不到控件? **********
- 关于JS 控制list翻页保存每页选中的状态--在线请教
- 谁能帮我把JS打字机效果与Js间隔向上滚动代码混合在一起。(提供现成代码)
- 图片幻灯片问题
- @@@通过JS判断URL来显示2级菜单的问题!!!!!
- 如何控制从数据库中动态调出的flash的尺寸大小和其它一些参数?!?!?!?!?!?
- 如何让鼠标在表格中各单元移动时不激活主表格的onmouseout?
- 有一个比较棘手的问题!
- safari 5.1 javascript 全屏 API
- 怎么动态的设置selectOneMenu控件的值
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>无标题文档</title>
<script>
// JavaScript Document
function $(d) {return document.getElementById(d);}
function ChangeItem(ServerList,CurrentServerList)
{
var ServerListObject=$(ServerList);
var CurrentServerListObject=$(CurrentServerList);
var additemlsit="";
var additemtext="";
for(var i=0;i<ServerListObject.length;i++)
{
if (ServerListObject[i].selected==true)
{
additemlsit=additemlsit+'|'+ServerListObject[i].value;
additemtext=additemtext+'|'+ServerListObject[i].text;
}
}
var additemlsit=additemlsit.split('|');
var additemtext=additemtext.split('|');
if(ServerListObject.options.length>0&&ServerListObject.selectedIndex!=-1)
{
for (i=0;i<additemlsit.length;i++)
{
if (additemlsit[i]!='')
{
var opt=document.createElement("OPTION");
opt.text=trim(additemtext[i]);
opt.value=additemlsit[i];
CurrentServerListObject.options.add(opt);
ServerListObject.remove(ServerListObject.selectedIndex);
}
}
}
}
function ChangeAllItem(ServerList,CurrentServerList)
{
var ServerListObject=$(ServerList);
var CurrentServerListObject=$(CurrentServerList);
var index=0;
var length=ServerListObject.options.length;
while(length>0&&index<length)
{
var serverobject=ServerListObject.options[index];
var opt=document.createElement("OPTION");
opt.text=serverobject.text;
opt.value=serverobject.value;
CurrentServerListObject.options.add(opt);
index=index+1;
}
while(ServerListObject.options.length>0)
{
ServerListObject.remove(0)
}
ServerListObject.selectedIndex=-1;
}
function trim(s){
return rtrim(ltrim(s));
}
function trim(s){
return rtrim(ltrim(s));
}
//去左空格;
function ltrim(s){
return s.replace( /^\s*/, "");
}
//去右空格;
function rtrim(s){
return s.replace( /\s*$/, "");
}
</script>
</head><body><table width="100%" cellpadding="5" cellspacing="0" border="0">
<tr>
<td width="40%">
<select id="ServerList" style="FONT-SIZE: 11px; WIDTH: 200px; HEIGHT: 200px" multiple size="8" name="ServerList">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
</select>
</td>
<td width="20%" align="center">
<input style="width:110px" onclick="ChangeItem('ServerList','CurrentServerList')" type=button value="添加>>"><br><br>
<input style="width:110px" onclick="ChangeItem('CurrentServerList','ServerList')" type=button value="<<删除"><br><br>
<input style="width:110px" onclick="ChangeAllItem('ServerList','CurrentServerList')" type=button value="全部添加>>"><br><br>
<input style="width:110px" onclick="ChangeAllItem('CurrentServerList','ServerList')" type=button value="<<全部删除"><br><br>
</td>
<td width="40%">
<select id="CurrentServerList" style="FONT-SIZE: 11px; WIDTH: 200px; HEIGHT: 200px" multiple size="8" name="CurrentServerList"></select>
</td>
</tr>
</table>
</body>
</html>