0
点赞
收藏
分享

微信扫一扫

HTML跟asp.net的服务器控件ListBox一样的功能


</pre><select id="firstselected" name="firstselected" size="10" multiple="MULTIPLE" style="height: 300px; width: 200px;">                        </select>                        <input type="button" value="<<" id="btn_addfirst" class="addBtn" />                        <input type="button" value=">>" id="btn_removefirst" class="addBtn" /><div></div><pre>

<select id="firstpreselected" size="10" multiple="MULTIPLE" style="height: 300px;

width: 200px;">
</selected>

<script type="text/javascript">
$(function () {
$("#btn_addfirst").bind("click", function () {
$("#firstpreselected option:selected").each(function () {
$("#firstselected").append("<option value=\"" + $.trim($(this).val()) + "\">" + $.trim($(this).html()) + "</option>");
$(this).remove();
});
});
$("#btn_removefirst").bind("click", function () {
$("#firstselected option:selected").each(function () {
$("#firstpreselected").append("<option value=\"" + $.trim($(this).val()) + "\">" + $.trim($(this).html()) + "</option>");
$(this).remove();
});
});
});</script>



举报

相关推荐

0 条评论