读书人

急 实现客户端左右移动的选项的有关问

发布时间: 2012-01-13 22:43:29 作者: rapoo

急!!~~~ 实现客户端左右移动的选项的问题?
代码:
<%@ 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>  


<SELECT style= "WIDTH: 216px; HEIGHT: 264px " size= "16 " id= "select1 " multiple runat= "server " ondblclick = "RemoveOneEvent() ">
<OPTION value= "0 "> 你好0 </OPTION>
<OPTION value= "1 "> 你好1 </OPTION>
<OPTION value= "2 "> 你好2 </OPTION>
<OPTION value= "3 "> 你好3 </OPTION>
<OPTION value= "4 "> 你好4 </OPTION>
</SELECT>          <INPUT id= "btnAddAll " style= "Z-INDEX: 103; LEFT: 264px; POSITION: absolute; TOP: 192px "
type= "button " value= " < < " onclick= "AddAllEvent() ">   <INPUT id= "btnAddOne " style= "Z-INDEX: 105; LEFT: 264px; POSITION: absolute; TOP: 144px "
type= "button " value= " < " onclick= "AddOneEvent() ">    <INPUT id= "btnRemoveOne " style= "Z-INDEX: 104; LEFT: 264px; POSITION: absolute; TOP: 96px "
type= "button " value= " > " onclick= "RemoveOneEvent() "> <INPUT style= "Z-INDEX: 102; LEFT: 264px; POSITION: absolute; TOP: 56px " type= "button " value= " > > "
id= "btnRemoveAll " onclick= "RemoveAllEvent() ">
<SELECT style= "Z-INDEX: 101; LEFT: 336px; WIDTH: 224px; POSITION: absolute; TOP: 16px; HEIGHT: 262px "
size= "16 " id= "select2 " multiple runat= "server " ondblclick = "AddOneEvent() ">
</SELECT>
</form>
</body>
</HTML>


为什么我点击保存时在代码中的列表中信息仍没有改变?
谢谢

[解决办法]
后台

要用request.form( " ")获取数据.不能用select1.value去取.

读书人网 >asp.net

热点推荐