1 <html>
2 <script language="javascript">
3 function addSrcToUser(value)
4 {
5 if (value == 'trade')
6 {
7 var D1=window.document.forms[0].userTradeListBox;
8 var srcList= window.document.forms[0].tradeListBox;
9 }
10 if(value=='tradeclass')
11 {
12 var srcList=window.document.forms[0].userTradeListBox;
13 var D1= window.document.forms[0].tradeListBox;
14
15 }
16 var len = D1.length;
17 for(var i = 0; i < srcList.length; i++)
18 {
19 //如果不为空,并且srcList有被选中的项就进行一下添加工作
20 if ((srcList.options[i] != null) && (srcList.options[i].selected))
21 {
22 var found = false;
23 for(var count = 0; count < len; count++)
24 {
25 if (D1.options[count] != null)
26 {
27 //如果D1中有与srcList相同的值则不需要在王D1中添加相同的值
28 if (srcList.options[i].text == D1.options[count].text)
29 {
30 found = true;
31 break;
32 }
33 }
34 }
35 //如果没有相同的值则添加srcList的值到D1中
36 if (found != true)
37 {
38
39 D1.options[len] = new Option(srcList.options[i].text);
40 D1.options[len].value = srcList.options[i].value;
41
42 len++;
43
44 }
45
46
47 }
48
49 }
50
51 deleteFromUser(value);
52
53
54 }
55
56
57 function deleteFromUser(value)
58 {
59 if (value == 'trade')
60 {
61 var D2 = window.document.forms[0].tradeListBox;
62 }
63 if (value == 'tradeclass')
64 {
65 var D2 = window.document.forms[0].userTradeListBox;
66 }
67
68 var len = D2.options.length;
69 for(var i = (len - 1); i >= 0; i--)
70 {
71 if ((D2.options[i] != null) && (D2.options[i].selected == true))
72 {
73 D2.options[i] = null;
74
75 }
76 }
77 }
78 </script>
79 <body>
80 <form name="form1" method="post" action="UserAddAmend.aspx?user=%u5f71%u97f3" id="form1">
81 <table>
82 <tr>
83 <td style="width: 100px">
84 <select size="10" name="tradeListBox" multiple="multiple" id="tradeListBox" name="tradeListBox">
85 <option value="021">IT</option>
86 <option value="005">安防</option>
87 <option value="053">办公用品</option>
88 <option value="083">泵阀</option>
89 <option value="044">表面处理</option>
90 <option value="073">灯饰</option>
91 <option value="006">电气</option>
92 <option value="018">电子</option>
93 <option value="085">房地产</option>
94 <option value="054">纺织</option>
95 <option value="071">服饰</option>
96 <option value="055">服装</option>
97 <option value="075">钢铁</option>
98 <option value="016">工程机械</option>
99 <option value="038">广电</option>
100 <option value="013">广告</option>
101 <option value="022">化工</option>
102 <option value="057">环保</option>
103 <option value="084">机床</option>
104 <option value="056">机械工业</option>
105 <option value="082">激光光电子</option>
106 <option value="042">家电</option>
107 <option value="058">家居用品</option>
108 <option value="059">建材</option>
109 <option value="026">建筑陶瓷</option>
110 <option value="060">交通运输</option>
111 <option value="003">教育</option>
112 <option value="039">酒店用品</option>
113 <option value="092">酒类</option>
114 <option value="061">礼品工艺品</option>
115 <option value="076">美容美发</option>
116 <option value="064">摩托车及配件</option>
117 <option value="062">能源</option>
118 <option value="020">暖通制冷</option>
119 <option value="051">皮革</option>
120 <option value="072">皮具</option>
121 <option value="041">汽车</option>
122 <option value="045">汽车配件</option>
123 <option value="034">汽车维修保养</option>
124 <option value="023">汽车用品</option>
125 <option value="069">商业服务</option>
126 <option value="032">石油</option>
127 <option value="065">食品工业</option>
128 <option value="019">水工业</option>
129 <option value="079">丝印特印</option>
130 <option value="030">塑料</option>
131 <option value="014">通信</option>
132 <option value="029">涂料</option>
133 <option value="002">玩具</option>
134 <option value="033">卫浴洁具</option>
135 <option value="074">五金</option>
136 <option value="050">消防</option>
137 <option value="025">小家电</option>
138 <option value="066">冶金矿产</option>
139 <option value="017">医疗器械</option>
140 <option value="028">医药</option>
141 <option value="043">音响灯光</option>
142 <option value="010">印刷</option>
143 <option value="024">影音</option>
144 <option value="068">运动休闲</option>
145 <option value="012">纸业</option>
146 <option value="078">制鞋工业</option>
147 <option value="047">制药工业</option>
148 <option value="077">珠宝首饰</option>
149
150 </select></td>
151 <td style="width: 100px">
152 <input id="Button1" type="button" value="添加 >>" onclick="javascript:addSrcToUser('trade')" />
153 <br />
154 <input id="Button2" type="button" value="删除 <<" onclick="javascript:addSrcToUser('tradeclass');" /></td>
155 <td style="width: 100px">
156 <select size="10" name="userTradeListBox" multiple="multiple" id="userTradeListBox" name="userTradeListBox">
157 <option value="024">影音</option>
158
159 </select></td>
160 </tr>
161 </table>
162 </form>
163 </body>
164 </html>
2 <script language="javascript">
3 function addSrcToUser(value)
4 {
5 if (value == 'trade')
6 {
7 var D1=window.document.forms[0].userTradeListBox;
8 var srcList= window.document.forms[0].tradeListBox;
9 }
10 if(value=='tradeclass')
11 {
12 var srcList=window.document.forms[0].userTradeListBox;
13 var D1= window.document.forms[0].tradeListBox;
14
15 }
16 var len = D1.length;
17 for(var i = 0; i < srcList.length; i++)
18 {
19 //如果不为空,并且srcList有被选中的项就进行一下添加工作
20 if ((srcList.options[i] != null) && (srcList.options[i].selected))
21 {
22 var found = false;
23 for(var count = 0; count < len; count++)
24 {
25 if (D1.options[count] != null)
26 {
27 //如果D1中有与srcList相同的值则不需要在王D1中添加相同的值
28 if (srcList.options[i].text == D1.options[count].text)
29 {
30 found = true;
31 break;
32 }
33 }
34 }
35 //如果没有相同的值则添加srcList的值到D1中
36 if (found != true)
37 {
38
39 D1.options[len] = new Option(srcList.options[i].text);
40 D1.options[len].value = srcList.options[i].value;
41
42 len++;
43
44 }
45
46
47 }
48
49 }
50
51 deleteFromUser(value);
52
53
54 }
55
56
57 function deleteFromUser(value)
58 {
59 if (value == 'trade')
60 {
61 var D2 = window.document.forms[0].tradeListBox;
62 }
63 if (value == 'tradeclass')
64 {
65 var D2 = window.document.forms[0].userTradeListBox;
66 }
67
68 var len = D2.options.length;
69 for(var i = (len - 1); i >= 0; i--)
70 {
71 if ((D2.options[i] != null) && (D2.options[i].selected == true))
72 {
73 D2.options[i] = null;
74
75 }
76 }
77 }
78 </script>
79 <body>
80 <form name="form1" method="post" action="UserAddAmend.aspx?user=%u5f71%u97f3" id="form1">
81 <table>
82 <tr>
83 <td style="width: 100px">
84 <select size="10" name="tradeListBox" multiple="multiple" id="tradeListBox" name="tradeListBox">
85 <option value="021">IT</option>
86 <option value="005">安防</option>
87 <option value="053">办公用品</option>
88 <option value="083">泵阀</option>
89 <option value="044">表面处理</option>
90 <option value="073">灯饰</option>
91 <option value="006">电气</option>
92 <option value="018">电子</option>
93 <option value="085">房地产</option>
94 <option value="054">纺织</option>
95 <option value="071">服饰</option>
96 <option value="055">服装</option>
97 <option value="075">钢铁</option>
98 <option value="016">工程机械</option>
99 <option value="038">广电</option>
100 <option value="013">广告</option>
101 <option value="022">化工</option>
102 <option value="057">环保</option>
103 <option value="084">机床</option>
104 <option value="056">机械工业</option>
105 <option value="082">激光光电子</option>
106 <option value="042">家电</option>
107 <option value="058">家居用品</option>
108 <option value="059">建材</option>
109 <option value="026">建筑陶瓷</option>
110 <option value="060">交通运输</option>
111 <option value="003">教育</option>
112 <option value="039">酒店用品</option>
113 <option value="092">酒类</option>
114 <option value="061">礼品工艺品</option>
115 <option value="076">美容美发</option>
116 <option value="064">摩托车及配件</option>
117 <option value="062">能源</option>
118 <option value="020">暖通制冷</option>
119 <option value="051">皮革</option>
120 <option value="072">皮具</option>
121 <option value="041">汽车</option>
122 <option value="045">汽车配件</option>
123 <option value="034">汽车维修保养</option>
124 <option value="023">汽车用品</option>
125 <option value="069">商业服务</option>
126 <option value="032">石油</option>
127 <option value="065">食品工业</option>
128 <option value="019">水工业</option>
129 <option value="079">丝印特印</option>
130 <option value="030">塑料</option>
131 <option value="014">通信</option>
132 <option value="029">涂料</option>
133 <option value="002">玩具</option>
134 <option value="033">卫浴洁具</option>
135 <option value="074">五金</option>
136 <option value="050">消防</option>
137 <option value="025">小家电</option>
138 <option value="066">冶金矿产</option>
139 <option value="017">医疗器械</option>
140 <option value="028">医药</option>
141 <option value="043">音响灯光</option>
142 <option value="010">印刷</option>
143 <option value="024">影音</option>
144 <option value="068">运动休闲</option>
145 <option value="012">纸业</option>
146 <option value="078">制鞋工业</option>
147 <option value="047">制药工业</option>
148 <option value="077">珠宝首饰</option>
149
150 </select></td>
151 <td style="width: 100px">
152 <input id="Button1" type="button" value="添加 >>" onclick="javascript:addSrcToUser('trade')" />
153 <br />
154 <input id="Button2" type="button" value="删除 <<" onclick="javascript:addSrcToUser('tradeclass');" /></td>
155 <td style="width: 100px">
156 <select size="10" name="userTradeListBox" multiple="multiple" id="userTradeListBox" name="userTradeListBox">
157 <option value="024">影音</option>
158
159 </select></td>
160 </tr>
161 </table>
162 </form>
163 </body>
164 </html>