- //移出控件的相同项:
- function removeSameItem(ctrlName) {
- var i = 0;
- for (i = 0; i < ctrlName.options.length; i++) {
- var k = 0;
- for (k = i + 1; k < ctrlName.options.length; ) {
- if (ctrlName.options[i].text == ctrlName.options[k].text) {
- ctrlName.options.remove(k);
- continue;
- }
- else {
- k++;
- }
- }
- }
- }
- //对于控件内容进行排序
- function ctrlItemSort(ctrlName, sortDir) {
- var i = 0;
- if (sortDir == null || sortDir == "asc")
- for (i = 0; i < ctrlName.options.length; i++) {
- var k = 0;
- for (k = i + 1; k < ctrlName.options.length; ) {
- if (ctrlName.options[i].text > ctrlName.options[k].text) {
- ctrlName.options[i].swapNode(ctrlName.options[k]);
- continue;
- }
- else {
- k++;
- }
- }
- }
- else {
- for (i = 0; i < ctrlName.options.length; i++) {
- var k = 0;
- for (k = i + 1; k < ctrlName.options.length; ) {
- if (ctrlName.options[i].text < ctrlName.options[k].text) {
- ctrlName.options[i].swapNode(ctrlName.options[k]);
- continue;
- }
- else {
- k++;
- }
- }
- }
- }
- }