实现动态页面传值 options动态显示数据

Vol_Outlay_ChooseSure <link href="../css/index.css" rel="stylesheet" type="text/css">
选择组 未选人员 已选人员
姚明 刘翔 李小双 刘德华 黎明 张学友 王晶 张艺谋 郑秀文 杰克逊



<<


>>
<script language="javascript" type="text/javascript"> function MoveSingleItem(sel_source, sel_dest){ if (sel_source.selectedIndex==-1){ if(sel_source.options.length>0){ var SelectedText = sel_source.options[sel_source.options.length-1].text; var objItemValue = sel_source.options[sel_source.options.length-1].value; sel_source.options.remove(sel_source.options.length-1); sel_dest.options.add(new Option(SelectedText,objItemValue)); } }else{ for(var i = sel_source.options.length-1; i >= 0; i--){ if (sel_source.options[i].selected == true) { var SelectedText = sel_source.options[i].text; var objItemValue = sel_source.options[i].value; sel_source.options.remove(i); sel_dest.options.add(new Option(SelectedText,objItemValue)); } } } } function re(sel_dest){ window.returnValue=getSelectedValue(sel_dest); window.close(); } function getSelectedValue(sel_dest){ var arr = new Array(); for(var i = sel_dest.options.length-1; i >= 0; i--){ arr[i] = sel_dest.options[i].value; } return arr; } function removeOption(sel){ sel.options.remove(0); } </script>
  1. <html>
  2. <head>
  3. <title>
  4. Vol_Outlay_ChooseSure
  5. </title>
  6. <linkhref="../css/index.css"rel="stylesheet"type="text/css"/>
  7. </head>
  8. <bodybgcolor="#ffffff"onLoad="removeOption(SelectedItem);">
  9. <tablewidth="80%"height="47%"border="1"cellpadding="0"cellspacing="0"align="center">
  10. <tr>
  11. <tdwidth="25%"height="34"align="right"valign="bottom"class="text">选择组</td>
  12. <tdwidth="12%"height="34"align="right"valign="bottom"class="text"></td>
  13. <tdwidth="%"height="34"align="center"valign="bottom"class="text">未选人员</td>
  14. <tdwidth="12%"></td>
  15. <tdwidth="25%"valign="bottom"class="text">已选人员</td>
  16. </tr>
  17. <tr><td></td><td></td>
  18. <tdheight="162"align=""valign="top">
  19. <selectname="SelectedItem"style="width:100%"id="SelectedItem"size="12"multiple="true">
  20. <option>姚明</option>
  21. <option>刘翔</option>
  22. <option>李小双</option>
  23. <option>刘德华</option>
  24. <option>黎明</option>
  25. <option>张学友</option>
  26. <option>王晶</option>
  27. <option>张艺谋</option>
  28. <option>郑秀文</option>
  29. <option>杰克逊</option>
  30. </select>
  31. </td>
  32. <tdalign="center"valign="top"><br/>
  33. <br/>
  34. <br/>
  35. <br/>
  36. <buttononClick="MoveSingleItem(WaitSelectItem,SelectedItem)"class="bn"><<</button>
  37. <br/>
  38. <br/>
  39. <br/>
  40. <buttononClick="MoveSingleItem(SelectedItem,WaitSelectItem)"class="bn">>></button></td>
  41. <tdvalign="top"><selectname="WaitSelectItem"style="width:100%"size=12multiple="true">
  42. </select></td>
  43. </tr>
  44. <tr>
  45. <tdalign="center"colspan="5"></td>
  46. </tr>
  47. <tr>
  48. <tdalign="center"colspan="5">
  49. <inputtype="button"name="chooseOk"class="bn"value="确定"onClick="re(WaitSelectItem);"/>
  50. <inputtype="button"name="reset"class="bn"value="取消"onClick="javascript:window.close();"/></td>
  51. </tr>
  52. </table>
  53. </body>
  54. </html>
  55. <scriptlanguage="javascript"type="text/javascript">
  56. functionMoveSingleItem(sel_source,sel_dest){
  57. if(sel_source.selectedIndex==-1){
  58. if(sel_source.options.length>0){
  59. varSelectedText=sel_source.options[sel_source.options.length-1].text;
  60. varobjItemValue=sel_source.options[sel_source.options.length-1].value;
  61. sel_source.options.remove(sel_source.options.length-1);
  62. sel_dest.options.add(newOption(SelectedText,objItemValue));
  63. }
  64. }else{
  65. for(vari=sel_source.options.length-1;i>=0;i--){
  66. if(sel_source.options[i].selected==true){
  67. varSelectedText=sel_source.options[i].text;
  68. varobjItemValue=sel_source.options[i].value;
  69. sel_source.options.remove(i);
  70. sel_dest.options.add(newOption(SelectedText,objItemValue));
  71. }
  72. }
  73. }
  74. }
  75. functionre(sel_dest){
  76. window.returnValue=getSelectedValue(sel_dest);
  77. window.close();
  78. }
  79. functiongetSelectedValue(sel_dest){
  80. vararr=newArray();
  81. for(vari=sel_dest.options.length-1;i>=0;i--){
  82. arr[i]=sel_dest.options[i].value;
  83. }
  84. returnarr;
  85. }
  86. functionremoveOption(sel){
  87. sel.options.remove(0);
  88. }
  89. </script>

你可能感兴趣的:(option)