Estoy tratando de hacer funcionar esta funcion.
Basicamente es un Menu que tiene la opciones: 0, 1 y 2. Y segun se seleccione hace aparecer unas tablas que tienen los id: id="Unit1" id="Unit2"
SOLO me hace aparecer la primera tabla pero luego si cambio la seleccion (por ejemplo de 2 a 0) ya no funciona.
Alguna idea. (tambien si alguien me dice como hacer esto de otra forma
![Afirmando](http://static.forosdelweb.com/fdwtheme/images/smilies/afirmar.gif)
function NumUnits(obj)
{
a=obj.options[obj.selectedIndex].text;
if(a == "Select one")
{
}
else
{
if(a == "0")
{
document.getElementById('Unit1').style.display ='none';
document.getElementById('Unit2').style.display ='none';
}
if(a == "1")
{
//primero las oculto por si estaban desocultas
document.getElementById('Unit1').style.display ='none';
document.getElementById('Unit2').style.display ='none';
document.getElementById('Unit1').style.display ='block';
document.getElementById('Unit2').style.display ='none';
}
if(a == "2")
{
//primero las oculto por si estaban desocultas
document.getElementById('Unit1').style.display ='none';
document.getElementById('Unit2').style.display ='none';
document.getElementById('Unit1').style.display ='block';
document.getElementById('Unit2').style.display ='block';
}
}
}
este es el menu:
<select name="select88" onChange="NumUnits(this)">
<option selected>Select one</option>
<option>0</option>
<option>1</option>
<option>2</option>
</select>