<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="MerchndsStockForSell.aspx.vb" Inherits="WebApplication_mmcs.MerchndsStockForSell" %>
<!DOCTYPE html>
<script>
function MoveItem(ctrlSource, ctrlTarget) {
var Source = document.getElementById(ctrlSource);
var Target = document.getElementById(ctrlTarget);
if ((Source != null) && (Target != null)) {
while ( Source.options.selectedIndex >= 0 ) {
var newOption = new Option(); // Create a new instance of ListItem
newOption.text = Source.options[Source.options.selectedIndex].text;
newOption.value = Source.options[Source.options.selectedIndex].value;
Target.options[Target.length] = newOption; //Append the item in Target
Source.remove(Source.options.selectedIndex); //Remove the item from Source
}
}
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
</head>
<body>
<form id="form1" runat="server">
<table>
<tr>
<td>
<asp:ListBox id="ListBox1" runat="server" Width="150px" Height="150px" SelectionMode="Multiple">
<asp:ListItem Value="1">One</asp:ListItem>
<asp:ListItem Value="2">Two</asp:ListItem>
<asp:ListItem Value="3">Three</asp:ListItem>
</asp:ListBox>
</td>
<td>
<p>
<input onclick="Javascript:MoveItem('ListBox1', 'ListBox2');" type="button" value="->" />
</p>
<p>
<input onclick="Javascript:MoveItem('ListBox2', 'ListBox1');" type="button" value="<-" />
</p>
</td>
<td>
<asp:ListBox id="ListBox2" runat="server" Width="150px" Height="150px" SelectionMode="Multiple">
<asp:ListItem Value="8">Eight</asp:ListItem>
<asp:ListItem Value="9">Nine</asp:ListItem>
<asp:ListItem Value="10">Ten</asp:ListItem>
</asp:ListBox>
</td>
</tr>
</table>
<div>
</div>
</form>
</body>
</html>
参考链接:
https://social.msdn.microsoft.com/Forums/sqlserver/ja-JP/93c0b3b1-6f91-4487-aa62-c32db0e9e0a4?forum=aspnetja
网友评论