function BindSelect(id,dataList,fieldtext,fieldValue) {
//Bind a certain data source, fieldtext is the text field that needs to be bound, fieldValue is the value field that needs to be bound
var select = $("#" id)[0];
for (var i = 0; i < dataList.length; i ) {
select.options.add(new Option(eval("dataList[" i "]." fieldtext), eval("dataList[" i "]." fieldValue)));
}
}
function BindSelectOptions(id, OptionList) {
var select = $("#" id)[0];
for (var i = 0 ; i < OptionList.length; i ) {
select.options.add(new Option(OptionList[i].Text, OptionList[i].Value));
}
}
function ClearAllItems(id) {//Clear all options
var select = $("#" id)[0];
select.options.length = 0;
}
function AddOneItem( id, text, value) {//Add an option
var select = $("#" id)[0];
select.options.add(new Option(text, value));
}
function selectOneOption(id, selectValue) {//Select an option based on the value
var select = $("#" id)[0];
var len = select.options.length;
for (var i = 0; i < len; i ) {
if (select.options[i].value == selectValue) {
select.options[i].selected = true;
break;
}
}
}
function selectOneOptionByIndex(id, index) {/// /According to the subscript, select an option
var select = $("#" id)[0];
var len = select.options.length;
if ( index >= 0 && index <= len) {
select.options[index].selected = true;
}
}