国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 網站 > WEB開發 > 正文

JS之下拉列表左右移動

2024-04-27 15:11:21
字體:
來源:轉載
供稿:網友

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>選擇式下拉菜單</title><script language="javascript" type="text/Javascript"> 	function moveOption(e1, e2){ 		try{ 			for(var i=0;i<e1.options.length;i++){ 				if(e1.options[i].selected){ 					var e = e1.options[i]; 					e2.options.add(new Option(e.text, e.value)); 					e1.remove(i); 					ii=i-1;				} 			} 			document.form1.city.value=getvalue(document.form1.list2); 		}catch(e){					} 	} 		function getvalue(geto){ 		var allvalue = ""; 		for(var i=0;i<geto.options.length;i++){ 			allvalue +=geto.options[i].value + ","; 		} 		return allvalue; 	}	 	function changepos(obj,index) 	{ 		if(index==-1){ 			if (obj.selectedIndex>0){ 				//obj.options(obj.selectedIndex).swapNode(obj.options(obj.selectedIndex-1)) //swapNode方法只有IE才支持				obj.insertBefore(obj.options[obj.selectedIndex], obj.options[obj.selectedIndex - 1]); 			} 		}else if(index==1){ 			if (obj.selectedIndex<obj.options.length-1){ 				//obj.options(obj.selectedIndex).swapNode(obj.options(obj.selectedIndex+1)) //swapNode方法只有IE才支持				obj.insertBefore(obj.options[obj.selectedIndex + 1], obj.options[obj.selectedIndex]);    			} 		} 	} </script><style type="text/CSS">body {	font-size: 16px;	color: #003300;}</style></head><body><form method="post" name="form1" action="" style="text-align:center;">  <table border="0" width="300" align="center">    <tr>      <td width="40%"><select style="width:100%" multiple name="list1" size="12" ondblclick="moveOption(document.form1.list1, document.form1.list2)">          <option value="張三">張三</option>          <option value="李四">李四</option>          <option value="王五">王五</option>          <option value="趙六">趙六</option>          <option value="錢七">錢七</option>          <option value="軟件">軟件</option>          <option value="客服">客服</option>          <option value="硬件">硬件</option>          <option value="安全">安全</option>          <option value="會計">會計</option>          <option value="出納">出納</option>        </select></td>      <td width="20%" align="center"><input type="button" value="添加" onclick="moveOption(document.form1.list1, document.form1.list2)"/>        <br/>        <br/>        <input type="button" value="刪除" onclick="moveOption(document.form1.list2, document.form1.list1)"/></td>      <td width="40%"><select style="width:100%" multiple name="list2" size="12" ondblclick="moveOption(document.form1.list2, document.form1.list1)">        </select></td>      <td><input type="button" value="上移" onclick="changepos(list2,-1)"/>        <br/>        <br/>        <input type="button" value="下移" onclick="changepos(list2,1)"/></td>    </tr>  </table>  值:  <input type="text" name="city" size="40" /></form><p align="center">選定一項或多項然后點擊添加或移除(按住shift或ctrl可以多選),<br />  或在選擇項上雙擊進行添加和移除。</p></body></html>


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 固阳县| 新民市| 台湾省| 肥西县| 吉林市| 辉县市| 隆昌县| 清流县| 大名县| 丽江市| 曲周县| 广宁县| 体育| 房山区| 龙井市| 古交市| 余姚市| 石门县| 新邵县| 东明县| 博罗县| 哈巴河县| 吴江市| 社会| 长宁县| 绥芬河市| 房产| 偏关县| 景德镇市| 巴楚县| 望城县| 潞西市| 苗栗市| 兰坪| 昭觉县| 资溪县| 沧州市| 开化县| 蓝山县| 区。| 万安县|