...

View Full Version : Combobox indexOf Error



Kylena
12-30-2003, 12:57 AM
I'm using the following code below:


var f = document.forms[0];
var specialRm = f.RoomSelection.options[f.RoomSelection.selecedIndex].text;
var chkIndex = specialRm.indexOf('(*)')

if (chkIndex == -1)
{
f.CoBrochures.style.visibility = 'visible';
for (i = 0; i < f.SpecialArrangements.length; i++)
{
f.SpecialArrangements[i].style.visibility = 'visible';
}

f.OtherArrangement.style.visibility = 'visible';
for (i = 0; i < f.VideoLanguage.length; i++)
{
f.VideoLanguage[i].style.visibility = 'visible';
}
}

else
{
f.CoBrochures.style.visibility = 'hidden';
for (i = 0; i < f.SpecialArrangements.length; i++)
{
f.SpecialArrangements[i].style.visibility = 'hidden';
}

f.OtherArrangement.style.visibility = 'hidden';
for (i = 0; i < f.VideoLanguage.length; i++)
{
f.VideoLanguage[i].style.visibility = 'hidden';
}
}

However, I can't seem to make it work. It keeps telling me that RoomSelection.options[...] is null or not defined.

I got too many options in the combobox called RoomSelection and some of the options contain (*) Meeting Room 1, (*) Meeting Room 2 & so on.

How should I modify the code so that it hides/unhide correctly?

Kylena
12-30-2003, 06:20 AM
There wasn't anything wrong. Just some typo.


var specialRm = f.RoomSelection.options[f.RoomSelection.selecedIndex].text;

:o



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum