Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hide / Unhide Based on Combobox Selection

R5 - Web Applications

Hide / Unhide Based on Combobox Selection

by  NiteLink  Posted    (Edited  )
Place the following in the onChange or onClick of the combobox:

Code:
var f = document.forms[0];
var specialRm = f.RoomSelection.options[f.RoomSelection.selectedIndex].text;
var chkIndex = specialRm.indexOf('(*)'); //Some of the options contain (*) therefore indexOf('(*)') is used.

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

	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'; //Radio
	}
}
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top