日期:2014-05-20  浏览次数:20405 次

急!!~~~ 实现客户端左右移动的选项的问题?
代码:
<%@   Page   language= "c# "   Codebehind= "WebForm1.aspx.cs "   AutoEventWireup= "false "   Inherits= "WebApplication1.WebForm1 "   %>
<!DOCTYPE   HTML   PUBLIC   "-//W3C//DTD   HTML   4.0   Transitional//EN "   >
<HTML>
<HEAD>
<title> WebForm1 </title>
<meta   content= "Microsoft   Visual   Studio   .NET   7.1 "   name= "GENERATOR ">
<meta   content= "C# "   name= "CODE_LANGUAGE ">
<meta   content= "JavaScript "   name= "vs_defaultClientScript ">
<meta   content= "http://schemas.microsoft.com/intellisense/ie5 "   name= "vs_targetSchema ">
<script   language= "javascript ">
function   RemoveAllEvent()
{
RemoveAll(window.document.getElementById( 'select1 '),window.document.getElementById( 'select2 '));
}

function   AddAllEvent()
{
RemoveAll(window.document.getElementById( 'select2 '),window.document.getElementById( 'select1 '));
}

function   RemoveOneEvent()
{
RemoveOne(window.document.getElementById( 'select1 '),window.document.getElementById( 'select2 '));
}

function   AddOneEvent()
{
RemoveOne(window.document.getElementById( 'select2 '),window.document.getElementById( 'select1 '));
}

function   RemoveAll(selectSource,selectGoal)
{
var   length   =   selectSource.length;

for(i   =   0;i   <   length;i++)
{
var   text   =   selectSource.options(i).text;
var   value   =   selectSource.options(i).value;
var   oOption   =   document.createElement( "OPTION ");
selectGoal.options.add(oOption);
oOption.innerText   =   text;
oOption.value   =   value;
}

for(i   =   0;i   <   length;i++)
{
selectSource.options.remove(0);
}
}

function   RemoveOne(selectSource,selectGoal)
{
var   ar   =   new   Array();//用于存储选择的项的索引
var   length   =   selectSource.length;

for(i   =   0;i   <   length;i++)
{
if   (selectSource.options(i).selected)
{
var   text   =   selectSource.options(i).text;
var   value   =   selectSource.options(i).value;
var   oOption   =   document.createElement( "OPTION ");
selectGoal.options.add(oOption);
oOption.innerText   =   text;
oOption.value   =   value;

ar[ar.length   +   1]   =   selectSource.options(i);  
}
}

for(i   =   0;i   <   length;i++)
{
for(j   =   0;j   <   ar.length;j++)
{
if   (selectSource.options(i)   ==   ar[j])
{
selectSource.options.remove(i);
}
}
}
}
</script>
</HEAD>
<body   ms_positioning= "GridLayout ">
<form   id= "form1 "   runat= "server ">
<FONT   face= "宋体 "> </FONT> &nbsp;