HTML:复制代码代码如下:未选择颜色:已选择颜色:蓝色红色132ondblclick="listMove('colorSelect','colorUnSelect','hidColorSelect',false,this.selectedIndex)"size="8" style="height: 200px; width: 90%;">红色紫色黄色黑色白色绿色粉红色对应JS方法:复制代码代码如下:function listMove(main, follow, hidetextbox, isBack, index) {if (index return;var o = undefined;var source;var distinct;var dddd;if (!isBack) {//使用getElementById在IE6中存在BUG source = $('#' + main);// window.document.getElementById(main);distinct = $('#' + follow); //window.document.getElementById(follow);}else {source = $('#' + follow); // window.document.getElementById(follow);distinct = $('#' + main); // window.document.getElementById(main);}var hid = $('#' + hidetextbox)[0]; // document.getElementById(hidetextbox);if (index != undefined) {var op = "option:eq(" + index + ")";source.find(op).each(function () {distinct.append("" + $(this).text() + "");$(this).remove();});}else {source.find("option:selected").each(function () {$(this).remove();distinct.append("" + $(this).text() + "");});}var str = "";//遍历Listbox,取得选中项的值$('#' + main + ' option').each(function () {str += $(this).val() + ',';});hid.value = str;}
相关文章
- Jquery ui datepicker设置日期范围,如只能隔3天【实现代码】_jquery
- 基于jQuery的让textarea支持Ctrl+Z步步撤销功能_jquery
- 如何利用Less实现CSS计数器的自动递增_封装counter-reset与increment
- html中summary标签用法 html中summary与details配合
- jquery.picsign组件使用详解
- 快速搞懂Node.js中的性能指标
- Jquery ThickBox插件使用心得(不建议使用)
- 为什么Ionic的CSS代码样式冲突?解决移动端样式问题的步骤
- HTML如何实现多语言切换?lang属性如何动态修改?
- React Native ImagePicker:解决相机上传图片失败问题
