You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

select_list_move.js 1.9 kB

13 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. var NS4 = (navigator.appName == "Netscape" && parseInt(navigator.appVersion) < 5);
  2. function addOption(theSel, theText, theValue)
  3. {
  4. var newOpt = new Option(theText, theValue);
  5. var selLength = theSel.length;
  6. theSel.options[selLength] = newOpt;
  7. }
  8. function swapOptions(theSel, index1, index2)
  9. {
  10. var text, value;
  11. text = theSel.options[index1].text;
  12. value = theSel.options[index1].value;
  13. theSel.options[index1].text = theSel.options[index2].text;
  14. theSel.options[index1].value = theSel.options[index2].value;
  15. theSel.options[index2].text = text;
  16. theSel.options[index2].value = value;
  17. }
  18. function deleteOption(theSel, theIndex)
  19. {
  20. var selLength = theSel.length;
  21. if(selLength>0)
  22. {
  23. theSel.options[theIndex] = null;
  24. }
  25. }
  26. function moveOptions(theSelFrom, theSelTo)
  27. {
  28. var selLength = theSelFrom.length;
  29. var selectedText = new Array();
  30. var selectedValues = new Array();
  31. var selectedCount = 0;
  32. var i;
  33. for(i=selLength-1; i>=0; i--)
  34. {
  35. if(theSelFrom.options[i].selected)
  36. {
  37. selectedText[selectedCount] = theSelFrom.options[i].text;
  38. selectedValues[selectedCount] = theSelFrom.options[i].value;
  39. deleteOption(theSelFrom, i);
  40. selectedCount++;
  41. }
  42. }
  43. for(i=selectedCount-1; i>=0; i--)
  44. {
  45. addOption(theSelTo, selectedText[i], selectedValues[i]);
  46. }
  47. if(NS4) history.go(0);
  48. }
  49. function moveOptionUp(theSel) {
  50. var index = theSel.selectedIndex;
  51. if (index > 0) {
  52. swapOptions(theSel, index-1, index);
  53. theSel.selectedIndex = index-1;
  54. }
  55. }
  56. function moveOptionDown(theSel) {
  57. var index = theSel.selectedIndex;
  58. if (index < theSel.length - 1) {
  59. swapOptions(theSel, index, index+1);
  60. theSel.selectedIndex = index+1;
  61. }
  62. }
  63. // OK
  64. function selectAllOptions(id)
  65. {
  66. var select = $('#'+id);/*
  67. for (var i=0; i<select.options.length; i++) {
  68. select.options[i].selected = true;
  69. }*/
  70. select.children('option').attr('selected', true);
  71. }

软件技术创新是当今国家整体创新能力的重要基础和发展引擎。近年来,大众参与的软件创新与创业活动已经成为网络时代软件开发和应用的新形态,正在快速改变着全球软件创新模式和软件产业格局。 ...