D
donald
I have a function called populate which populate a select box. I need
it to run when a different select box value is chnage. So I need the
event onChange.
But i need to pass it two var to. how do i do this??
object.onchange = ..
What do I made it equal to for the above. if the typename = 'type1' and
itemname = 'item1'.
Can I do setAttribute or some think??
Thanks
Donald
function populate(typename,itemname)
{
if (!optionTest) return;
var type = document.forms[formname].elements[typename];
var number = type.options[type.selectedIndex].value;
alert(number);
if (!number) return;
var list = items[number];
var item = document.forms[formname].elements[itemname];
item.options.length = 0;
if (number == 0) {
item.options[0] = new Option('Pick Item ---->','');
alert('');
return;
}
for(i=0;i<list.length;i+=1)
{
item.options = new Option(list,'');
}
};
it to run when a different select box value is chnage. So I need the
event onChange.
But i need to pass it two var to. how do i do this??
object.onchange = ..
What do I made it equal to for the above. if the typename = 'type1' and
itemname = 'item1'.
Can I do setAttribute or some think??
Thanks
Donald
function populate(typename,itemname)
{
if (!optionTest) return;
var type = document.forms[formname].elements[typename];
var number = type.options[type.selectedIndex].value;
alert(number);
if (!number) return;
var list = items[number];
var item = document.forms[formname].elements[itemname];
item.options.length = 0;
if (number == 0) {
item.options[0] = new Option('Pick Item ---->','');
alert('');
return;
}
for(i=0;i<list.length;i+=1)
{
item.options = new Option(list,'');
}
};