Foros del Web » Programando para Internet » Javascript »

ocultar todo div

Estas en el tema de ocultar todo div en el foro de Javascript en Foros del Web. buenas hola chicos tengo una funcion que me sive para hacer ocultar y aparece un div. mi pregunta es como aria para ocultar todos los ...
  #1 (permalink)  
Antiguo 23/11/2011, 18:01
Avatar de arcanisgk122  
Fecha de Ingreso: junio-2010
Mensajes: 755
Antigüedad: 13 años, 11 meses
Puntos: 28
ocultar todo div

buenas hola chicos tengo una funcion que me sive para hacer ocultar y aparece un div.

mi pregunta es como aria para ocultar todos los div y que solo uno quede visible:

dejo micodigo.

Código Javascript:
Ver original
  1. function mostrar(whichLayer)
  2. {
  3.  
  4.   var elem, vis;
  5.   if(document.getElementById) // this is the way the standards work
  6.     elem = document.getElementById( whichLayer );
  7.   else if( document.all ) // this is the way old msie versions work
  8.       elem = document.all[whichLayer];
  9.   else if( document.layers ) // this is the way nn4 works
  10.     elem = document.layers[whichLayer];
  11.   vis = elem.style;
  12.  
  13.  
  14.   // if the style.display value is blank we try to figure it out here
  15.   if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
  16.     vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
  17.   vis.display = (vis.display==''||vis.display=='block')?'none':'block';
  18.  
  19. }

todo lo que quiero ocultar esta aki adentro:
Código HTML:
Ver original
  1. <td name="ocultos" id="ocultos" style="height: 310px; border: 1px solid;" colspan="3" rowspan="5">
  2. </td>
__________________
Cooler Master Gladiator 600 - AMD PHENOM II X4 955 @ 3.5GHZ
GA-MA78GM-US2H - Super Talent 800 2GB x 2 Dual, (Unganged)
PSU Cooler Master eXtreme Power Plus 500W - Saphire R7-260OC-2GB

Última edición por arcanisgk122; 23/11/2011 a las 18:23

Etiquetas: funcion, todo
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 02:49.