select option 的處理 賦值之前先全部清除option

/**
       add by ......

**/

 

function setItemTypeCodeSub(Field){
 var currentcoutn= getElementOrder(Field)-1;
   if(fm.ItemCodeSub[currentcoutn].value=='' || fm.ItemCodeSub[currentcoutn].value==null)
    {
     return;
    }else{
    if(fm.ItemCodeSub[currentcoutn].value=='0001')
    {
     var aName = new Array('蘋果','梨','海棠','山楂','沙果','榲桲');    //option
     fm.ItemTypeCodeSub[currentcoutn].options.length   =   0; //添加之前先進行清除old
     for(j=0;j<aName.length;j++)
      {
        var option=document.createElement("option");
        var strFieldName=aName[j];
        var strFieldValue=aName[j];
        option.value=strFieldName;
        option.text=strFieldValue;
        fm.ItemTypeCodeSub[currentcoutn].add(option);
      }
     
    }
   }
 }

 

 

 

 

 

                <td>
               <select name="ItemTypeCodeMain"  style="width:60px" onchange="">
                </select>
               </td>

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章