Hello everyone,I am trying to get the value of one Combobox “Region” and using Switch I am putting a set a value to an another combobox “StoreName” for one of the my Web application.
I have created a Function “RegionChanged” and I am calling this function from onchange event of “Region” field.
Here is the code which I have written. I am not able to get the selected value of “Region” field. Could anybody help me out to get the selected value… Many thankx in advance… Piyush
function RegionChanged()
{
var Region1 = document.getElementById(‘Region’);
for (var i = 0; i<4; i++)
{
var myIndex = Region1[i];
if (myIndex.selected)
{
var selval = myIndex.value;
}
}
switch (selval)
{
case “B”:
addoption(“A”,“A”) ;
addoption(“B”,“B”) ;
break;
}
}
function addoption(text,val)
{
var oOption = document.createElement(“OPTION”);
var StoreName1 = document.getElementById(‘StoreName’);
StoreName.options.add(oOption);
oOption.innerText = text;
oOption.value = val;
}