tengo el siguiente código:
Código :
function Visual (obj)
{
if (document.getElementById(obj).style.display=='none')
{
document.getElementById(obj).style.display='';
}
else
{document.getElementById(obj).style.display='none';}
}
function Ver (obj)
{
if (document.getElementById(obj).style.display=='none')
{
document.getElementById(obj).style.display='';
}
}
function NoVer (obj)
{
if (document.getElementById(obj).style.display=='')
{
document.getElementById(obj).style.display='none';
}
}
function OcultarTodo(num)
{
for (i=0;i<num;i++) {
obj = 'seccion'+i;
NoVer(eval("'"+obj+"'"));
}
}
function OcultarTodoUnidad(num)
{
for (i=20;i<num;i++) {
obj = 'seccion'+i;
NoVer(eval("'"+obj+"'"));
}
}
Lo que hace es al hacer clic sobre el link despliega hacia abajo el contenido de ese link, y al hacer clic en otro link contenedor cierra el primero y se abre.
Lo que estoy necesitando, porque no sé nada de JS, es agregarle la función para que al hacer clic nuevamente en el mismo link que está abierto lo cierre. Tengo el siguiente codigo que hace eso, pero no supe cómo implementarlo junto al anterior:
Código :
function show(id) {
document.getElementById('_'+id).style.display = 'block';
document.getElementById('link'+id).href = 'javascript:hide('+id+')';
}
function hide(id) {
document.getElementById('_'+id).style.display = 'none';
document.getElementById('link'+id).href = 'javascript:show('+id+')';
}
Saludos y garcias!!!!!
Emiliano
