復制代碼 代碼如下:
<table cellSpacing="0" borderColorDark="#ffffff" cellPadding="3"
align="left" borderColorLight="#000000">
<tr bgColor="#cccccc">
<td><b>所有地區</b> <asp:HiddenField runat="server" /> </td>
<td> </td>
<td><b>已選地區</b></td>
</tr>
<tr >
<td bgcolor="#cccccc" >
<asp:listbox runat="server" SelectionMode="Single"></asp:listbox></td>
<td valign="top" bgcolor="#cccccc">
<asp:Panel runat="server" >
<br> <br>
<%--<asp:Button Text="選擇→" runat="server"/>--%>
<INPUT type="button" value="選擇→" onclick = "add('listNewEmp','listright','HidDistrictId')" Text="選擇→">
<br>
<br>
<INPUT type="button" value="←刪除" onclick = "move('listright')" Text="←刪除">
<%--<asp:Button Text="←刪除" runat="server"/>--%>
</asp:Panel>
</td>
<td bgcolor="#cccccc">
<asp:listbox runat="server" SelectionMode="Multiple"></asp:listbox>
</td>
</tr>
</table>
復制代碼 代碼如下:
<script language="Javascript">
function add(sourlist, deslist,hidId)
{ //添加
var objres = document.getElementById(sourlist);
var objsel = document.getElementById(deslist);
var customOptions;
for(var i = objres.options.length - 1 ;i >= 0;i--)
{
if(objres.options[i].selected)
{
customOptions = document.createElement("OPTION");
customOptions.text = objres.options[i].text;
customOptions.value = objres.options[i].value;
if (objsel.options.length>0)
objsel.remove(objsel.options.length - 1);
document.getElementById(hidId).value = customOptions.value;
objsel.add(customOptions,0);
}
}
return false;
}
function move(deslist) { //刪除
var objres = document.getElementById(deslist);
objres.remove(objres.options.length - 1);
}
</script>
新聞熱點
疑難解答
圖片精選