@@ -1,14 +1,12 | |||||
1 | var NS4 = (navigator.appName == "Netscape" && parseInt(navigator.appVersion) < 5); |
|
1 | var NS4 = (navigator.appName == "Netscape" && parseInt(navigator.appVersion) < 5); | |
2 |
|
2 | |||
3 | function addOption(theSel, theText, theValue) |
|
3 | function addOption(theSel, theText, theValue) { | |
4 | { |
|
|||
5 | var newOpt = new Option(theText, theValue); |
|
4 | var newOpt = new Option(theText, theValue); | |
6 | var selLength = theSel.length; |
|
5 | var selLength = theSel.length; | |
7 | theSel.options[selLength] = newOpt; |
|
6 | theSel.options[selLength] = newOpt; | |
8 | } |
|
7 | } | |
9 |
|
8 | |||
10 | function swapOptions(theSel, index1, index2) |
|
9 | function swapOptions(theSel, index1, index2) { | |
11 | { |
|
|||
12 | var text, value; |
|
10 | var text, value; | |
13 | text = theSel.options[index1].text; |
|
11 | text = theSel.options[index1].text; | |
14 | value = theSel.options[index1].value; |
|
12 | value = theSel.options[index1].value; | |
@@ -18,41 +16,30 function swapOptions(theSel, index1, index2) | |||||
18 | theSel.options[index2].value = value; |
|
16 | theSel.options[index2].value = value; | |
19 | } |
|
17 | } | |
20 |
|
18 | |||
21 | function deleteOption(theSel, theIndex) |
|
19 | function deleteOption(theSel, theIndex) { | |
22 | { |
|
|||
23 | var selLength = theSel.length; |
|
20 | var selLength = theSel.length; | |
24 | if(selLength>0) |
|
21 | if (selLength > 0) { | |
25 | { |
|
|||
26 | theSel.options[theIndex] = null; |
|
22 | theSel.options[theIndex] = null; | |
27 | } |
|
23 | } | |
28 | } |
|
24 | } | |
29 |
|
25 | |||
30 | function moveOptions(theSelFrom, theSelTo) |
|
26 | function moveOptions(theSelFrom, theSelTo) { | |
31 | { |
|
|||
32 |
|
||||
33 | var selLength = theSelFrom.length; |
|
27 | var selLength = theSelFrom.length; | |
34 | var selectedText = new Array(); |
|
28 | var selectedText = new Array(); | |
35 | var selectedValues = new Array(); |
|
29 | var selectedValues = new Array(); | |
36 | var selectedCount = 0; |
|
30 | var selectedCount = 0; | |
37 |
|
||||
38 | var i; |
|
31 | var i; | |
39 |
|
32 | for (i = selLength - 1; i >= 0; i--) { | ||
40 | for(i=selLength-1; i>=0; i--) |
|
33 | if (theSelFrom.options[i].selected) { | |
41 | { |
|
|||
42 | if(theSelFrom.options[i].selected) |
|
|||
43 | { |
|
|||
44 | selectedText[selectedCount] = theSelFrom.options[i].text; |
|
34 | selectedText[selectedCount] = theSelFrom.options[i].text; | |
45 | selectedValues[selectedCount] = theSelFrom.options[i].value; |
|
35 | selectedValues[selectedCount] = theSelFrom.options[i].value; | |
46 | deleteOption(theSelFrom, i); |
|
36 | deleteOption(theSelFrom, i); | |
47 | selectedCount++; |
|
37 | selectedCount++; | |
48 | } |
|
38 | } | |
49 | } |
|
39 | } | |
50 |
|
40 | for (i = selectedCount - 1; i >= 0; i--) { | ||
51 | for(i=selectedCount-1; i>=0; i--) |
|
|||
52 | { |
|
|||
53 | addOption(theSelTo, selectedText[i], selectedValues[i]); |
|
41 | addOption(theSelTo, selectedText[i], selectedValues[i]); | |
54 | } |
|
42 | } | |
55 |
|
||||
56 | if(NS4) history.go(0); |
|
43 | if (NS4) history.go(0); | |
57 | } |
|
44 | } | |
58 |
|
45 | |||
@@ -73,8 +60,7 function moveOptionDown(theSel) { | |||||
73 | } |
|
60 | } | |
74 |
|
61 | |||
75 | // OK |
|
62 | // OK | |
76 | function selectAllOptions(id) |
|
63 | function selectAllOptions(id) { | |
77 | { |
|
|||
78 | var select = $('#'+id); |
|
64 | var select = $('#'+id); | |
79 | select.children('option').attr('selected', true); |
|
65 | select.children('option').attr('selected', true); | |
80 | } |
|
66 | } |
General Comments 0
You need to be logged in to leave comments.
Login now