字典表左右选择

<!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>
<title>管理中心 - 添加新配送点 </title>
<meta name="robots" content="noindex, nofollow">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="./app/view/back/styles/general.css" rel="stylesheet" type="text/css" />
<link href="./app/view/back/styles/main.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="./app/view/back/js/shehe.js"></script>
<style type="text/css">
body{ background:#EEEEEE;margin:0; padding:0; font-family:"微软雅黑", Arial, Helvetica, sans-serif; }
a{ color:#006600; text-decoration:none;}
a:hover{color:#990000;}
.top{ margin:5px auto; color:#990000; text-align:center;}
.info select{ border:1px #993300 solid; background:#FFFFFF;}
.info{ margin:5px; text-align:center;}
.info #show{ color:#3399FF; }
.bottom{ text-align:right; font-size:12px; color:#CCCCCC; 1000px;}
</style>
<style>
button{
border:1px solid #ccc;
cursor:pointer;
display:block;
margin:auto;
position:relative;
top:100px;
}</style>


<script language="javascript">
function fun_select_addany(theform){
var i;
for (i=0;i<theform.s_county.length;i++){
if (theform.s_county.options[i].selected == true){
if (theform.s_county.options[i].text !=""){
theform['right_select[]'].options[theform['right_select[]'].length]=new Option(theform.s_county.options[i].text);
theform.s_county.options[i] =new Option("");
}
}
}
for (i=0;i<theform.s_county.length;i++){
if (theform.s_county.options[i].text ==""){theform.s_county.options.remove(i); i--;}
}
}

function fun_select_addall(theform){
var i;
for (i=0;i<theform.s_county.length;i++){
if (theform.s_county.options[i].text !=""){
theform['right_select[]'].options[theform['right_select[]'].length]=new Option(theform.s_county.options[i].text);
}
}
theform.s_county.length=0;
}

function fun_select_dltany(theform){
var i;
for (i=0;i<theform['right_select[]'].length;i++){
if (theform['right_select[]'].options[i].selected == true){
if (theform['right_select[]'].options[i].text !=""){
theform.s_county.options[theform.s_county.length]=new Option(theform['right_select[]'].options[i].text);
theform['right_select[]'].options[i] =new Option("");
}
}
}
for (i=0;i<theform['right_select[]'].length;i++){
if (theform['right_select[]'].options[i].text ==""){theform['right_select[]'].options.remove(i);i--;}
}
}
function fun(){
var right_sel=document.getElementById("all_menu_list");
var ops = right_sel.getElementsByTagName('option') ;
console.log(ops);
console.log(ops.length);
for(var i=0; i<=ops.length; i++) {
ops[i].selected = true;
}
alert(right_sel);
}
function fun_select_dltall(theform){
var i;
for (i=0;i<theform['right_select[]'].length;i++){
if (theform['right_select[]'].options[i].text !=""){
theform.s_county.options[theform.s_county.length]=new Option(theform['right_select[]'].options[i].text);
}
}
theform['right_select[]'].length=0;
}
window.onload = function() {
_init_area();
}
</script>
</head>

<body>

<h1>
<span class="action-span"><a href="index.php?p=back&c=Peisongdian&a=listAll">查看全部配送点
</a></span>
<span class="action-span1"><a href="index.php?act=main">管理中心</a> </span><span id="search_id" class="action-span1"> - 添加新配送点</span>

</h1>
<!-- start goods form -->
<div class="tab-div">
<!-- tab bar -->
<div id="tabbar-div">
<p>
<span class="tab-front" id="general-tab">通用信息</span>
<span class="tab-back" id="detail-tab">详细描述</span>
<span class="tab-back" id="mix-tab">其他信息</span>
<span class="tab-back" id="gallery-tab">商品相册</span>
</p>
</div>

<!-- tab body -->
<form action="xx.php" method="post" name="myform" >
<!-- 第一个选的 -->
<table width="90%" id="general-table" align="center" border="0">

<!-- 这里开始 -->
<tr >
<td></td>
<td>
<select id="s_province" name="s_province"></select>&nbsp;&nbsp;
<select id="s_city" name="s_city" ></select>&nbsp;&nbsp;
</td>
</tr>
<tr>
<td></td>
<td align="center">

<div style=" 150px; height: 190px ;float: left;">
<select multiple="true" ; style="150px; height: 180px;"id='s_county' name='s_county' >
</select>
</div>
<div style=" 80px;float: left;">
<input language="javascript" name="btn_select_addany" onClick="fun_select_addany(document.myform)" type=button value="添加一个">
<input language="javascript" name="btn_select_addall" onClick="fun_select_addall(document.myform)" type=button value="添加全部">
<input language="javascript" name="btn_select_dltany" onClick="fun_select_dltany(document.myform)" type=button value="删除一个">
<input language="javascript" name="btn_select_dltall" onClick="fun_select_dltall(document.myform)" type=button value="删除全部">
</div>
<script src="http://sandbox.runjs.cn/uploads/rs/267/g3ugugjp/area.js" type="text/javascript"></script>
<div style="150px; height: 190px;float: left;" id="heh">
<select id="all_menu_list" name="right_select[]" size="15" multiple="true" style="150px; height: 180px" >
</select>
</div>

</td>

</table>
<div class="button-div">
<input type="submit" value=" 确定 " class="button" onclick="fun()" />
</div>
</form>
</div>

</body>
</html>

原文地址:https://www.cnblogs.com/huangf714/p/5908060.html