这里有拖动行的示例,但不见得会适合你。
-----
http://d.download.csdn.net/down/259544/JK_10000

解决方案 »

  1.   

    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>JK:支持民族工业,尽量少买X货</title>
    <script  language=javascript>
    var selectedTr=null;function c1(obj){
     obj.style.background='#FFFFFF'; //把点到的那一行变希望的颜色;
     if(selectedTr!=null) selectedTr.style.background="";
     if(selectedTr==obj) selectedTr=null;
     else selectedTr=obj;
    }function changeTrBackground(obj,color)
    {
      if(selectedTr!=obj)  obj.style.backgroundColor=color;
    }</script>
    </head><body>
    <div style="font-size:10pt;">
    注1:单击选中Tr,高亮显示,再单击取消选选中。。 <br/>           
           <br/>    
    注:本页面仅在IE6/Firefox1.5下测试过。其它浏览器或其它版本未经测试。<br/>           
    注-----:JK:<a href="mailTo:[email protected]?subject=About SelectAndSubSelect">[email protected]</a><br/>        
    <hr/>    
    </div> 
     <input type=button value="选中的是哪一行?" onclick="alert(selectedTr?selectedTr.innerHTML:'没有选中行');">
     <input type=button value="上移" onclick="if(selectedTr && selectedTr.rowIndex>0) selectedTr.parentNode.insertBefore(selectedTr,selectedTr.previousSibling);">
     <input type=button value="下移" onclick="if(selectedTr && selectedTr.nextSibling) selectedTr.parentNode.insertBefore(selectedTr,selectedTr.nextSibling.nextSibling);">
     <input type=button value="重新生成序号" onclick="var rows=document.getElementById('table01').rows;for(var i=0;i<rows.length;i++) rows[i].cells[0].innerHTML=(i+1);">
      <table width="100%" border="1" cellspacing="0" cellpadding="0" bgcolor="#cccccc" id=table01 >
        <tr onclick="c1(this);" onmouseover="changeTrBackground(this,'red');" onmouseout="changeTrBackground(this,'');">
          <td >1 </td>
          <td >a </td>
        </tr>
        <tr onclick="c1(this);" onmouseover="changeTrBackground(this,'red');" onmouseout="changeTrBackground(this,'');">
          <td >2 </td>
          <td >b </td>
        </tr>
        <tr onclick="c1(this);" onmouseover="changeTrBackground(this,'red');" onmouseout="changeTrBackground(this,'');">
          <td >3 </td>
          <td >c </td>
        </tr>
      </table>
    </body>
    </html>
      

  2.   

    sorry,以上代码在ff下测试有问题,是因为tr与tr之间的空格在ff下不会忽略。
    请自行改正
      

  3.   

    谢谢,我有这样一个思路,不知怎么实现,将有一列(序号列)的表格始终定位在textarea内的最左侧,然后客户端可以对textarea的每一条目进行排序,可否?
      

  4.   

    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>JK:支持民族工业,尽量少买X货</title>
    </head> 
    <body >
     
    <div style="font-size:10pt;">
    注1:左右移动进行选取 <br/>      
    注2:已解决的问题 <br/>      
    ----能进行多行排序<br/> 
    ----解决排序时滚动条归零的问题<br/> 
    <br/> 
    <br/>
    注:本页面仅在IE6/FireFox1.5下测试过。其它浏览器或其它版本未经测试。<br/>       
    注-----:作者JK:<a href="mailTo:[email protected]?subject=About%20MoveRightOrLeft">[email protected]</a><br/>    
    <hr/>
    </div><form name=frm><table>
    <tr > 
    <td> 
    <select name=SrcSelect size=6 style="height:160px;width:200px;" multiple ondblclick="moveLeftOrRight(document.frm.SrcSelect,document.frm.ObjSelect)"> 
    <option value="1">test1</option> 
    <option value="2">test2</option> 
    <option value="3">test3</option> 
    <option value="4">test4</option> 
    <option value="5">test5</option> 
    <option value="6">test6</option> 
    <option value="7">test7</option> 
    <option value="8">test8</option> 
    <option value="9">test9 abcde abcde abcde abcde abcde abcde abcde abcde </option> 
    </select>
    </td> 
    <td width="30px">    
    <input align="left" type=button value=">>"  onclick="moveLeftOrRightAll(document.frm.SrcSelect,document.frm.ObjSelect)"  ><br><br>
    <input align="left" type=button value=">"  onclick="moveLeftOrRight(document.frm.SrcSelect,document.frm.ObjSelect)"  ><br><br>
    <input align="left" type=button value="<"  onclick="moveLeftOrRight(document.frm.ObjSelect,document.frm.SrcSelect)"  ><br><br>
    <input align="left" type=button value="<<"  onclick="moveLeftOrRightAll(document.frm.ObjSelect,document.frm.SrcSelect)"  >
    </td>
    <td> 
    <select name=ObjSelect size=6 style="height:160px;width:200px;" multiple ondblclick="moveLeftOrRight(document.frm.ObjSelect,document.frm.SrcSelect)"> 
    <option value="11">test11</option> 
    <option value="12">test12</option> 
    <option value="13">test13</option> 
    <option value="14">test14</option> 
    <option value="15">test15</option> 
    <option value="16">test16</option> 
    </select>
    </td> 
    <td width="30px">
    <input type=button value="AA"  onclick="moveToTop(document.frm.ObjSelect)" > <br><br> 
    <input type=button value="A"  onclick="moveUp(document.frm.ObjSelect)" > <br><br> 
    <input type=button value="V"  onclick="moveDown(document.frm.ObjSelect)" ><br><br> 
    <input type=button value="VV"  onclick="moveToBottom(document.frm.ObjSelect)" > </td>
    </tr> 
    </table></form>
    </body>  
      
    <script language=javascript srccccc="CommonJS_SwapOption.js">  function moveLeftOrRight(fromObj,toObj)  
    {
    var fromObjOptions=fromObj.options;
    for(var i=0;i<fromObjOptions.length;i++){
    if(fromObjOptions[i].selected){
    toObj.appendChild(fromObjOptions[i]);
    i--;
    }
    }
    }  function moveLeftOrRightAll(fromObj,toObj)  
    {
    var fromObjOptions=fromObj.options;
    if(fromObjOptions.length>1000) {
    //if(!confirm("Are you sure to move options?")) return false;
    }
    for(var i=0;i<fromObjOptions.length;i++){
    fromObjOptions[0].selected=true;
    toObj.appendChild(fromObjOptions[i]);
    i--;
    }
    }  function moveUp(selectObj)  

    var theObjOptions=selectObj.options;
    for(var i=1;i<theObjOptions.length;i++) {
    if( theObjOptions[i].selected && !theObjOptions[i-1].selected ) {
    swapOptionProperties(theObjOptions[i],theObjOptions[i-1]);
    }
    }
    }  
      
    function moveDown(selectObj)  

    var theObjOptions=selectObj.options;
    for(var i=theObjOptions.length-2;i>-1;i--) {
    if( theObjOptions[i].selected && !theObjOptions[i+1].selected ) {
    swapOptionProperties(theObjOptions[i],theObjOptions[i+1]);
    }
    }
    }  function moveToTop(selectObj){
    var theObjOptions=selectObj.options;
    var oOption=null;
    for(var i=0;i<theObjOptions.length;i++) {
    if( theObjOptions[i].selected && oOption) {
    selectObj.insertBefore(theObjOptions[i],oOption);
    }
    else if(!oOption && !theObjOptions[i].selected) {
    oOption=theObjOptions[i];
    }
    }
    }function moveToBottom(selectObj){
    var theObjOptions=selectObj.options;
    var oOption=null;
    for(var i=theObjOptions.length-1;i>-1;i--) {
    if( theObjOptions[i].selected ) {
    if(oOption) {
    oOption=selectObj.insertBefore(theObjOptions[i],oOption);
    }
    else oOption=selectObj.appendChild(theObjOptions[i]);
    }
    }}function selectAllOption(selectObj){
    var theObjOptions=selectObj.options;
    for(var i=0;i<theObjOptions.length;i++){
    theObjOptions[0].selected=true;
    }
    }/* private function */
    function swapOptionProperties(option1,option2){
    //option1.swapNode(option2);
    var tempStr=option1.value;
    option1.value=option2.value;
    option2.value=tempStr;
    tempStr=option1.text;
    option1.text=option2.text;
    option2.text=tempStr;
    tempStr=option1.selected;
    option1.selected=option2.selected;
    option2.selected=tempStr;
    }
    </script> 
      

  5.   

    还是没解决固定序号列的问题,可以利用css控制,但是无法解决同步滚动的问题
      

  6.   

    我想了个办法,给单元格加滚动条,如下:
    <table border=1 width="361">
       <tr>
         <td><div style="width:100%;height:100;overflow-x:hidden;overflow-y:scroll">
           <table border="0" width="100%" id="table1">
    <tr>
    <td>1</td>
    <td rowspan="12">

    <select size="99"  multiplename="D1" name="1">
    <option>aaaa</option>
    <option>asdd</option>
    <option>aaaa</option>
    <option>asdd</option>
    <option>aaaa</option>
    <option>asdd</option>
    <option>aaaa</option>
    <option>asdd</option>
    <option>aaaa</option>
    <option>asdd</option>
    <option>aaaa</option>
    <option>asdd</option>
    </select>
    </td>
    </tr>
    <tr>
    <td>2</td>
    </tr>
    <tr>
    <td>3</td>
    </tr>
    <tr>
    <td>4</td>
    </tr>
    <tr>
    <td>5</td>
    </tr>
    <tr>
    <td>6</td>
    </tr>
    <tr>
    <td>7</td>
    </tr>
    <tr>
    <td>8</td>
    </tr>
    <tr>
    <td>9</td>
    </tr>
    <tr>
    <td>10</td>
    </tr>
    <tr>
    <td> </td>
    </tr>
    <tr>
    <td> </td>
    </tr>
    </table>
        
         </div>
         </td>
         <td width="80">右单元格
         </td>
       </tr>
    </table>
    但是移动选项时滚动条无法同步滚动,咋整?
      

  7.   

    "还是没解决固定序号列的问题"
    ----
    可以用js改变option的text
    ----基本问题请查参考书或请教身边的同事
      

  8.   

    请看该帖:
    http://topic.csdn.net/u/20071017/13/8f278740-e692-4b39-bf97-289d538a914c.html