将两种数据分别放到两个List中,在页面上将List中的内容按其在List中下标序列出,这样就可以用JavaScript操作其下标来实现左右移动,待提交时,后台提取参与移动的下标号列表,就可以确定移动的是那些数据,以及从哪个List移出

解决方案 »

  1.   

    给你段代码,自己改动改动就行。让他onclick事件放到你自己移动按钮上,移动同时删除被移动栏的,就等于那个删除功能。
    <html><head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <meta name="GENERATOR" content="Microsoft FrontPage 4.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <title>可选内容</title><SCRIPT LANGUAGE="JavaScript">
    <!-- Begin
    function moveOver()  
    {
    var boxLength = document.choiceForm.choiceBox.length;
    var selectedItem = document.choiceForm.available.selectedIndex;
    var selectedText = document.choiceForm.available.options[selectedItem].text;
    var selectedValue = document.choiceForm.available.options[selectedItem].value;
    var i;
    var isNew = true;
    if (boxLength != 0) {
    for (i = 0; i < boxLength; i++) {
    thisitem = document.choiceForm.choiceBox.options[i].text;
    if (thisitem == selectedText) {
    isNew = false;
    break;
          }
       }

    if (isNew) {
    newoption = new Option(selectedText, selectedValue, false, false);
    document.choiceForm.choiceBox.options[boxLength] = newoption;
    }
    document.choiceForm.available.selectedIndex=-1;
    }
    function removeMe() {
    var boxLength = document.choiceForm.choiceBox.length;
    arrSelected = new Array();
    var count = 0;
    for (i = 0; i < boxLength; i++) {
    if (document.choiceForm.choiceBox.options[i].selected) {
    arrSelected[count] = document.choiceForm.choiceBox.options[i].value;
    }
    count++;
    }
    var x;
    for (i = 0; i < boxLength; i++) {
    for (x = 0; x < arrSelected.length; x++) {
    if (document.choiceForm.choiceBox.options[i].value == arrSelected[x]) {
    document.choiceForm.choiceBox.options[i] = null;
       }
    }
    boxLength = document.choiceForm.choiceBox.length;
       }
    }
    function saveMe() {
    var strValues = "";
    var boxLength = document.choiceForm.choiceBox.length;
    var count = 0;
    if (boxLength != 0) {
    for (i = 0; i < boxLength; i++) {
    if (count == 0) {
    strValues = document.choiceForm.choiceBox.options[i].value;
    }
    else {
    strValues = strValues + "," + document.choiceForm.choiceBox.options[i].value;
    }
    count++;
       }
    }
    if (strValues.length == 0) {
    alert("您没有选择任何内容");
    }
    else {
    alert("您选择的内容如下:\r\n"+"第" + strValues+"条");
       }
    }
    //  End -->
    </script></head><body>
    <center>
    <form name="choiceForm">
    <table border=0>
    <tr>
            <td valign="top" width=175> 
              <div align="center">可选内容:<br>
                <select name="available" size=10 onchange="moveOver();">
                  <option value="1">内容一</option>
                  <option value="2">内容二</option>
                  <option value="3">内容三</option>
                  <option value="4">内容四</option>
                  <option value="5">内容五</option>
                  <option value="6">内容六</option>
                  <option value="7">内容七</option>
                  <option value="8">内容八</option>
                  <option value="9">内容九</option>
                  <option value="10">内容十</option>
                </select>
              </div>
            </td>
            <td valign="top"> 
              <div align="center">你的选择:<br>
                <select multiple name="choiceBox" style="width:150;" size="10">
                </select>
              </div>
            </td>
    </tr>
    <tr>
            <td colspan=2 height=10> 
              <div align="center">
                <input type="button" value="删除" onclick="removeMe();">
                <input type="button" value="结果" onclick="saveMe();">
              </div>
            </td>
    </tr>
    </table>
    </form>
    </center>
    </body></html>
      

  2.   

    先谢谢大家~ 不过,用select功能上还不太够,希望每一条数据项都是多选框+文字链接的形式,通过多选框是否选中来移动对应项,点击链接还能出现那条数据的具体信息,请问有没有方法?