日期:2014-05-16 浏览次数:20441 次
function ExistValue(obj,value){
    for(var i=0;i<obj.options.length;i++){
        if(obj.options[i].value == value){
            return true;
        }
    }      
    return false;
}function AddItem(obj,text,value){
 var varItem = new Option(text,value);
 obj.options.add(varItem);
}function RemoveItems(obj,value){
 for(var i=0;i<obj.options.length;i++){
  if(obj.options[i].value == ItemValue){
   obj.options.remove(i);
  }
 }        function RemoveItem(obj,index){
 obj.options.remove(index);
}function UpdateItem(obj,index,value,text){
 obj.options[index].value = value;
 obj.options[index].text = text;
}function SelectItemByText(obj,text){    
    var isExit = false;
    for(var i=0;i<obj.options.length;i++){
        if(obj.options[i].text == text){
            obj.options[i].selected = true;
            return true;
        }
    }
 return false;
 
}function SelectItemByValue(obj,value){    
    var isExit = false;
    for(var i=0;i<obj.options.length;i++){
        if(obj.options[i].value == value){
            obj.options[i].selected = true;
            return true;
        }
    }
 return false;
 
}function GetValue(obj){
 return obj.value; 
}function GetIndex(obj){
 return obj.selectedIndex; 
}function GetText(obj){
 return obj.options[obj.selectedIndex].text;
}function Clear(obj){
 obj.options.length = 0; 
}