<BODY>
<script language="javascript">
<!--
function add(type){
if(type==1)
{
for(i=0;i<document.getElementById("parentselect").options.length;i++)
{
if( document.getElementById("parentselect").options[i].selected == true )
{
flag=true
for(var j=0;j<document.getElementById("childselect").options.length;j++)
{
if(document.getElementById("childselect").options[j].text==document.getElementById("parentselect").options[i].text)
{
flag=false
break;
}
}
if(flag)
document.getElementById("childselect").options.add( new Option( document.getElementById("parentselect")[i].text,document.getElementById("parentselect")[i].value ) );
}
}
}
else
{
document.getElementById("childselect").options.length=0;
for(i=0;i<document.getElementById("parentselect").options.length;i++)
{
document.getElementById("childselect").options.add( new Option( document.getElementById("parentselect")[i].text,document.getElementById("parentselect")[i].value ) );
}
}
}
function remove(type){
if( type==2 )
{
document.getElementById("childselect").options.length=0;
return;
}
for(i=document.getElementById("childselect").options.length-1;i>=0;i--)
{
if( document.getElementById("childselect").options[i].selected == true )
{
document.getElementById("childselect").options.remove(i);
}
}
}
//-->
</script>
<table width="790" border="0" cellpadding="0" cellspacing="0">
<tr valign="middle">
<td height="15" colspan="7" align="left" valign="middle"><hr size="1" noshade></td>
</tr>
<tr align="center" valign="middle">
<td height="20" colspan="2" align="right"> </td>
<td width="150" valign="middle">左select</td>
<td width="85"> </td>
<td>右select</td>
<td> </td>
<td> </td>
</tr>
<tr align="center" valign="middle">
<td height="198" colspan="2" align="right"></td>
<td align="center" valign="middle"><select name="parentselect" id="parentselect" size="16" multiple>
<option>北京</option>
<option>上海</option>
<option>天津</option>
<option>纽约</option>
<option>伦敦</option>
<option>香港</option>
<option>巴黎</option>
<option>等等</option>
</select>
</td>
<td valign="middle"><p class="button1">
<input name="search23" type="button" class="input0" id="search232" value="添加多个" onclick="add(1)">
<br/>
<input name="search2" type="button" class="input0" id="search25" value="添加全部" onclick="add(2)">
<br/>
<input name="search222" type="button" class="input0" id="search2223" value="删除选中" onclick="remove(1)">
<br/>
<input name="search22" type="button" class="input0" id="search224" value="全部删除" onclick="remove(2)">
</p>
</td>
<td align="center" valign="middle"><select name="childselect" id="dest" size="16" multiple>
</select>
</td>
</tr>
</table>
</BODY>
<script language="javascript">
<!--
function add(type){
if(type==1)
{
for(i=0;i<document.getElementById("parentselect").options.length;i++)
{
if( document.getElementById("parentselect").options[i].selected == true )
{
flag=true
for(var j=0;j<document.getElementById("childselect").options.length;j++)
{
if(document.getElementById("childselect").options[j].text==document.getElementById("parentselect").options[i].text)
{
flag=false
break;
}
}
if(flag)
document.getElementById("childselect").options.add( new Option( document.getElementById("parentselect")[i].text,document.getElementById("parentselect")[i].value ) );
}
}
}
else
{
document.getElementById("childselect").options.length=0;
for(i=0;i<document.getElementById("parentselect").options.length;i++)
{
document.getElementById("childselect").options.add( new Option( document.getElementById("parentselect")[i].text,document.getElementById("parentselect")[i].value ) );
}
}
}
function remove(type){
if( type==2 )
{
document.getElementById("childselect").options.length=0;
return;
}
for(i=document.getElementById("childselect").options.length-1;i>=0;i--)
{
if( document.getElementById("childselect").options[i].selected == true )
{
document.getElementById("childselect").options.remove(i);
}
}
}
//-->
</script>
<table width="790" border="0" cellpadding="0" cellspacing="0">
<tr valign="middle">
<td height="15" colspan="7" align="left" valign="middle"><hr size="1" noshade></td>
</tr>
<tr align="center" valign="middle">
<td height="20" colspan="2" align="right"> </td>
<td width="150" valign="middle">左select</td>
<td width="85"> </td>
<td>右select</td>
<td> </td>
<td> </td>
</tr>
<tr align="center" valign="middle">
<td height="198" colspan="2" align="right"></td>
<td align="center" valign="middle"><select name="parentselect" id="parentselect" size="16" multiple>
<option>北京</option>
<option>上海</option>
<option>天津</option>
<option>纽约</option>
<option>伦敦</option>
<option>香港</option>
<option>巴黎</option>
<option>等等</option>
</select>
</td>
<td valign="middle"><p class="button1">
<input name="search23" type="button" class="input0" id="search232" value="添加多个" onclick="add(1)">
<br/>
<input name="search2" type="button" class="input0" id="search25" value="添加全部" onclick="add(2)">
<br/>
<input name="search222" type="button" class="input0" id="search2223" value="删除选中" onclick="remove(1)">
<br/>
<input name="search22" type="button" class="input0" id="search224" value="全部删除" onclick="remove(2)">
</p>
</td>
<td align="center" valign="middle"><select name="childselect" id="dest" size="16" multiple>
</select>
</td>
</tr>
</table>
</BODY>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货