javascript - Single Click issue in IE 6 -


i have following code. code populates list box basing on selection done. code works on ie 7 & fails on ie 6.

//---------------------------------------------------------------------------------------------- //fill location list on basis of country  function filllocationlist() {     var opt =  document.createelement("option");     var selected =document.getelementbyid('drpcountryname').selectedindex;     var size = document.getelementbyid('drpcountryname').options.length;      if(!event.ctrlkey && !event.shiftkey)      {          document.getelementbyid('drplocation').options.length = 0;         for(var i=0;i<locationarray.value.length;i++)         {              //if(document.getelementbyid('drplocationreportsto').value == locationarray.value[i].locationrptid)             if(document.getelementbyid('drpcountryname').value == locationarray.value[i].countrycode)             {                  opt =  document.createelement("option");                  opt.text = locationarray.value[i].locationname;                  opt.value=locationarray.value[i].locationid;                  document.getelementbyid("drplocation").options.add(opt);             }         }       }       else if(event.ctrlkey || event.shiftkey)     {          document.getelementbyid('drplocation').length = 0;         for(j=0;j<document.getelementbyid('drpcountryname').length;j++)         {            var currentlocation = document.getelementbyid('drpcountryname').options[j].value;             if(document.getelementbyid('drpcountryname').options[j].selected)             {                    for(var i=0;i<locationarray.value.length;i++)                 {                      if(currentlocation == locationarray.value[i].countrycode)                     {                          opt =  document.createelement("option");                          opt.text = locationarray.value[i].locationname;                          opt.value=locationarray.value[i].locationid;                          document.getelementbyid("drplocation").options.add(opt);                     }                 }             }        }      }  } 

is function fired under ie6? because common problem attach function onclick event (which has problems under ie6).

use onchange instead.


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -