As shown below:
Copy code code as follows:
<! Doctype HTML PUBLIC "-// W3C // DTD XHTML 1.0 Transitional // EN" http://www.w3.org/xhtml1/dtddml1-transitationAl.dtd ">
<html xmlns = "http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv = "content-type" content = "text /html; charset = utf-8" /> />
<Title> Non -Title Document </Title>
<script type = "text/javascript">
Function Copytolist (from, to) {
var fromlist = eval ('document.forms [0].'+from);
var Tolist = Eval ('Document.forms [0].'+to);
if (toList.options.length> 0 && Tolist.options [0]. Value == 'Temp') {
Tolist.options.Length = 0;
}
var sel = false;
for (i = 0; I <teomlist.options.length; i ++) {
var Current = FromList.Options [i];
if (Current.select) {
SEL = TRUE;
If (Current.value == 'Temp') {{
Alert ('Can't choose this project!');
Return;
}
txt = Current.text;
value = Current.value;
toList.options [toList.length] = New Option (txt, value);
FromList.options [i] = null;
i ---;
}
}
if (! SEL) Alert ('You haven't chosen any project yet!');
}
function allSelect () {
var chsen = document.GetelementByid ('chosen');
// If the chsen list box is 0 or the first option value is 'Temp'
if (chsen.length && chsen.opting [0]. Value == "Temp")
Return;
for (var I = 0; I <chsen.length; i ++) {
chsen.options [i] .select = true;
}
// get data
Function getdata () {
var list = document.forms [0] .rolelist;
// get a hidden text box object
var roles = document.GetelementByid ("TroleList");
roles.value = "";
var s = "";
if (list.length! = 0) {{
for (i = 0; I <list.length; i ++) {
s + = list.option [i]. Value + ","
}
}
Roles.value = s;
}
}
</script>
</head>
<body>
<Table>
<FORM ONSUBMIT = "AllSelect ()">
<tr>
<TD>
<select name = "postible" size = "4" multiple>
<option value = "1"> Guangzhou, China </option>
<option value = "2"> Shanghai, China </option>
<option value = "3"> Beijing, China </option>
<option value = "4"> China Wuhan </option>
</select>
</td>
<td> <a href = "javascript: Copytolist ('Possible', 'Chosen')"> Add to the right-> <br>
<br>
</a> <a href = "javascript: Copytolist ('chosen', 'postible')"> <-Add to the left </a> </td>
<TD>
<select name = "chosen" size = "4" multiple>
<option value = "test"> Select your area from the left </option>
</select>
</td>
</tr>
</form>
</table>
<input type = "Button" value = "Submit" onClick = "AllSelect ()" /> YLE
<input type = "text" style = "display: none;" id = "truelist">
</body>
</html>