I don’t know how to describe it, there are two select pull-downs, made into text fields, where you can select the value from the result set on one side and add it to the other side; after the other side is deleted, the value will be back to the result set. Let’s take a look at the example demonstration directly. I believe you will use the latter in the future!
Not much, please add the code:
The code copy is as follows:
<!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>select</title>
<script type="text/javascript" src="jquery.min.js"></script>
<script>
$(function(){
$("#car_type_list").dblclick(function(){
var s_val = this.value;
if(s_val == '') return;
$(this).children("option[value='"+s_val+"']").remove();
$("#car_type").append('<option value="'+s_val+'">'+s_val+'</option>');
//The following code is to back up the selected value to an input with id car_type_val, and you can pass the value
$("#car_type_val").val($("#car_type_val").val()+s_val+"@");
alert($("#car_type_val").val())
});
$("#car_type").dblclick(function(){
var s_val = this.value;
if(s_val == '') return;
$(this).children("option[value='"+s_val+"']").remove();
$("#car_type_list").append('<option value="'+s_val+'">'+s_val+'</option>');
var now_val = $("#car_type_val").val();
now_val = now_val.replace(s_val+"@","");
$("#car_type_val").val(now_val);
alert($("#car_type_val").val())
});
})
</script>
</head>
<body>
<input type="hidden" name="car_type" value="" id="car_type_val" /><br/>
<select multiple="multiple" style="min-width:200px; min-height:80px;" id="car_type">
</select><>
<select multiple="multiple" style="min-width:200px; min-height:80px;" id="car_type_list">
<option value="2014 Forest Man Series">2014 Forest Man Series</option>
<option value="2014 Outback Series">2014 Outback Series</option>
<option value="2014 Legacy Series">2014 Legacy Series</option>
<option value="2014XV Series">2014XV Series</option>
<option value="WRX STI">WRX STI</option>
<option value="SUBARU BRZ">SUBARU BRZ</option>
<option value="TRIBECA">TRIBECA</option>
</select>
</body>
</html>
The function of "<input type="hidden" name="car_type" value="" id="car_type_val" />" is equivalent to a container, and the value can be passed when submitting the form. To the page that receives the value, use the corresponding language, such as php, use the exploit function and divide it into an array with "@" as the boundary.