表   --〉〉 table???

解决方案 »

  1.   

    getelementbyid   getelementbytagname
      

  2.   

    给你个下拉列表的
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html>
    <head>
    <title>Just Select</title>
    <script language="javascript" type="text/javascript">
    function OnRightClicked()
    {
    var theLeft = document.getElementById("select_one");
    var theRight = document.getElementById("select_two");
    var l_index= theLeft.selectedIndex;
    if (l_index < 0)
    {
    alert("请先在左侧选择一项");
    return ;
    }
    var newOption = document.createElement("OPTION");
    newOption.value = theLeft.options[l_index].value;
    newOption.text = theLeft.options[l_index].text;
    theRight.add(newOption);
    // 删除左侧的
    theLeft.remove(l_index);
    }

    function OnRightAllClicked()
    {
    var l_index;
    var theLeft = document.getElementById("select_one");
    var theRight = document.getElementById("select_two");
    var l_length = theLeft.options.length;
    for (l_index = 0; l_index < l_length; l_index++)
    {
    var newOption = document.createElement("OPTION");
    newOption.value = theLeft.options[0].value;
    newOption.text = theLeft.options[0].text;
    theRight.add(newOption);
    // 删除左侧的
    theLeft.remove(0);
    }
    }
    function OnLeftClicked()
    {
    var theLeft = document.getElementById("select_one");
    var theRight = document.getElementById("select_two");
    var l_index= theRight.selectedIndex;
    if (l_index < 0)
    {
    alert("请先在右侧选择一项");
    return ;
    }
    var newOption = document.createElement("OPTION");
    newOption.value = theRight.options[l_index].value;
    newOption.text = theRight.options[l_index].text;
    theLeft.add(newOption);
    // 删除左侧的
    theRight.remove(l_index);
    }

    function OnLeftAllClicked()
    {
    var l_index;
    var theLeft = document.getElementById("select_one");
    var theRight = document.getElementById("select_two");
    var l_length = theRight.options.length;
    for (l_index = 0; l_index < l_length; l_index++)
    {
    var newOption = document.createElement("OPTION");
    newOption.value = theRight.options[0].value;
    newOption.text = theRight.options[0].text;
    theLeft.add(newOption);
    // 删除左侧的
    theRight.remove(0);
    }
    }
    </script>
    </head><body><table id="table_main" width="200">
    <tr>
    <td width="40%">
    <select id="select_one" size="10">
    <option value="1">One</option>
    <option value="2">Two</option>
    <option value="3">Three</option>
    <option value="4">Four</option>
    <option value="5">Five</option>
    <option value="6">Six</option>
    <option value="7">Seven</option>
    </select>
    </td>
    <td width="20%">
    <table id="table_op" boarder="0">
    <tr height="25%">
    <td>
    <input id="button_right" type="button" value="     >    " onclick="OnRightClicked()">
    </td>
    </tr>
    <tr height="25%">
    <td>
    <input id="button_right_all" type="button" value="    >>    " onclick="OnRightAllClicked()">
    </td>
    </tr>
    <tr height="25%">
    <td>
    <input id="button_left" type="button" value="     <    " onclick="OnLeftClicked()">
    </td>
    </tr>
    <tr height="25%">
    <td>
    <input id="button_left_all" type="button" value="    <<    " onclick="OnLeftAllClicked()">
    </td>
    </tr>
    </table>
    </td>
    <td width="40%">
    <select id="select_two" size="10">
    </select>
    </td>
    </tr>
    </table>
    </body>
    </html>
      

  3.   

    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>made by meixx</title>
    <style type="css/text">
    body{font-size:10pt}
    </style>
    <script language="javascript">
    <!--
    var curRowSource=null;
    var curRowTarget=null;
    function selectRow(obj){
    if(curRowSource){
    curRowSource.style.backgroundColor="#FFFFFF";
    curRowSource.style.color="#000000";
    }
    obj.style.backgroundColor="#3366FF";
    obj.style.color="#FFFFFF";
    curRowSource=obj;
    var btns=document.getElementsByName("btn");
    btns[0].disabled=false;
    }
    function selectRow1(obj){
    if(curRowTarget){
    curRowTarget.style.backgroundColor="#FFFFFF";
    curRowTarget.style.color="#000000";
    }
    obj.style.backgroundColor="#3366FF";
    obj.style.color="#FFFFFF";
    curRowTarget=obj;
    var btns=document.getElementsByName("btn");
    btns[2].disabled=false;
    }
    function Add(tbSou,tbTar){
    var rowSou=null;
    var newRow=tbTar.insertRow();
    if(tbSou.id=="tbSource"){
    rowSou=curRowSource;
    newRow.attachEvent("onclick",function(){selectRow1(newRow);});
    }
    else{
    rowSou=curRowTarget;
    newRow.attachEvent("onclick",function(){selectRow(newRow);});
    }
    for(var i=0;i<rowSou.cells.length;i++){
    var newCell=newRow.insertCell();
    newCell.innerHTML=rowSou.cells[i].innerHTML;
    }
    tbSou.deleteRow(rowSou.rowIndex);
    var btns=document.getElementsByName("btn");
    btns[0].disabled=true;
    btns[2].disabled=true;
    }function AddAll(tbSource,tbTarget){
    for(var i=1;;i++){
    if(tbSource.rows.length==1) return;
    tbSource.rows[1].click();
    Add(tbSource,tbTarget);
    }

    }
    function doSubmit(){
    SelectAll(frmDisplay.dltTarget);
    //frmDisplay.action="";//设置form 提交的action
    alert(frmDisplay.action);
    //frmDisplay.submit();//取消注释即可,提交上去的options
    }
    //->
    </script>
    </head><body>
    <table width="550" border="1" style="border-collapse:collapse " bordercolor="#111111" cellpadding="0" cellspacing="0">
      <tr>
        <td width="250" valign="top">
    <table id="tbSource" cellpadding="0" cellspacing="0" border="1" style="border-collapse:collapse;cursor:default" bordercolor="#CCFFFF" width="100%">
    <tr>
    <td align="center" width="25%">姓名</td><td align="center" width="25%">性别</td><td align="center" width="25%">年龄</td><td align="center" width="25%">身高</td>
    </tr>
    <tr onclick="selectRow(this)">
    <td>冯程程</td><td>女</td><td>22</td><td>167</td>
    </tr>
    <tr onclick="selectRow(this)">
    <td>任盈盈</td><td>女</td><td>19</td><td>168</td>
    </tr>
    <tr onclick="selectRow(this)">
    <td>杨玉环</td><td>女</td><td>18</td><td>162</td>
    </tr>
    <tr onclick="selectRow(this)">
    <td>赢政</td><td>男</td><td>45</td><td>182</td>
    </tr>
    <tr onclick="selectRow(this)">
    <td>项少龙</td><td>男</td><td>28</td><td>176</td>
    </tr>
    </table>
    </td>
        <td width="50" valign="middle">
    <br>
    <p style="width:100%" align="center"><input name="btn" type="button" value="->" onClick="Add(document.all.tbSource,tbTarget)" title="添加" disabled></p>
    <p style="width:100%" align="center"><input name="btn" type="button" value="=>" onClick="AddAll(document.all.tbSource,tbTarget)" title="添加全部"></p>
    <p style="width:100%" align="center"><input name="btn" type="button" value="<-" onClick="Add(tbTarget,document.all.tbSource)" title="删除" disabled></p>
    <p style="width:100%" align="center"><input name="btn" type="button" value="<=" onClick="AddAll(tbTarget,document.all.tbSource)" title="删除全部"></p>
    <br>
    </td>
        <td width="250" valign="top">
    <form id="frmDisplay" action="xxx.jsp" method="post" style="margin:0 ">
    <table id="tbTarget" cellpadding="0" cellspacing="0" border="1" style="border-collapse:collapse" bordercolor="#CCFFFF" width="100%">
    <tr>
    <td align="center" width="25%">姓名</td><td align="center" width="25%">性别</td><td align="center" width="25%">年龄</td><td align="center" width="25%">身高</td>
    </tr>
    </table>
    </form>
    </td>
      </tr>
      <tr>
     
        <td align="center">
    <input type="reset" onClick="javascript:window.location.reload();" value="重置">&nbsp;&nbsp;
    <input type="button" value="提交" onClick="doSubmit()">2
    </td>
      </tr>
    </table></body>
    </html>