Hi Folks,
I have a problem with the section of code below.
The function populate works fine but the function populate2 generates the error 'length is null or not an object'
Any ideas on why this is happening??
I have a problem with the section of code below.
The function populate works fine but the function populate2 generates the error 'length is null or not an object'
Any ideas on why this is happening??
Code:
function populate()
{
var box = document.forms[0].first;
var number = box.options[box.selectedIndex].value;
if (!number) return;
var list = adddes[number];
var box2 = document.forms[0].second;
box2.options.length = 0;
for(i=0;i<list.length;i+=1)
{
box2.options[i] = new Option(list[i],list[i]);
}
}
function populate2()
{
var box = document.forms[0].second;
var number = box.options[box.selectedIndex].value;
if (!number) return;
var list = adddes[number];
var box2 = document.forms[0].third;
box2.options.length = 0;
for(i=0;i<list.length;i+=1)
{
box2.options[i] = new Option(list[i],list[i]);
}
}