Hola
La solución que planteas es totalmente válida. Pero y si no sabes la cantidad de elementos, por que se crearán dinámicamente, entonces deberías de usar esta otra función
Código javascript
:
Ver originalvar valor = null;
function funcion(elem) {
obj = document.getElementById(elem);
obj.style.display = (obj==valor) ? 'none' : 'block';
if (valor != null)
valor.style.display = 'none';
valor = (obj==valor) ? null : obj;
}
Código html:
Ver originalonchange = "funcion(document.getElementById(this.options[this.selectedIndex].value))"
Suerte