如何使用java脚本将所选数据库值设置为多个html选择 [英] how to set selected database value to multiple html select using java script
本文介绍了如何使用java脚本将所选数据库值设置为多个html选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果我选择任何记录我想要突出显示多个选择选项中的选择项我在json写这行但是它不起作用请帮助我
< br $>
if i selected any record i want highlight the selects item in multiple select option i write this line in json but it doesn't work please help me
BindAgnGroup(document.getElementById("cmb_agency"));
//BindAgnGroup(document.getElementById("cmb_group")).value = response.d[0].agroup;
var selected = document.getElementById('cmb_group');
//selected.onchange = function () {
for (var i = 0; i < response.d[0].agroup.length; i++) {
selected.options[i].selected = true;
}
推荐答案
您无需编写任何内容即可显示多个选定值。因为你已经写了多个=倍数,它指定可以一次选择多个选项。要做到这一点,你需要按住(按)控制(ctrl)按钮/键选择多个选项。
You do not need to write anything to display multiple selected values. Because you are already writing multiple="multiple" which specifies that multiple options can be selected at once.To do that you need to hold down(press)the control(ctrl)button/key to select multiple options.
这篇关于如何使用java脚本将所选数据库值设置为多个html选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文