Posted on 2008-07-12 17:38
G_G 阅读(202)
评论(0) 编辑 收藏 所属分类:
HTML
html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<form action="">
<table>
<tr>
<td>
<select id="s1" size="5">
<option>-1-</option>
<option>-2-</option>
<option>-3-</option>
</select>
</td>
<td>
<input type="button" value=">>" onclick="optionRemove('s1','s2');"/>
<input type="button" value="<<" onclick="optionRemove('s2','s1');"/>
</td>
<td>
<select id="s2" size="5">
</select>
</td>
</tr>
</table>
</form>
</body>
<script type="text/javascript">
function optionRemove(selFromById,selToById){
var sf = document.getElementById(selFromById);
var st = document.getElementById(selToById);
var mo = sf.options[sf.selectedIndex];
var moTest = mo.text ;
var moValue = mo.value ;
sf.remove(sf.selectedIndex);
st.options.add(new Option(moTest,moValue ),0)
}
</script>
</html>