Ver Mensaje Individual
  #3 (permalink)  
Antiguo 26/04/2011, 08:47
jonnyalexbh
 
Fecha de Ingreso: marzo-2011
Mensajes: 26
Antigüedad: 13 años, 2 meses
Puntos: 0
Exclamación Respuesta: Problema con div

Un ejemplo mas claro seria esto como pongo a funcionar este codigo javascript en el ciclo php segun cada linea del ciclo

Código HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script>
// definiciones basicas
OCULTO="none";
VISIBLE="block";
 
function mostrar(blo) {
  document.getElementById(blo).style.display=VISIBLE;
  document.getElementById('ver_off').style.display=VISIBLE;
  document.getElementById('ver_on').style.display=OCULTO;
}
 
function ocultar(blo) 
{
  document.getElementById(blo).style.display=OCULTO;
  document.getElementById('ver_off').style.display=OCULTO;
  document.getElementById('ver_on').style.display=VISIBLE;
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin título</title>
</head>
<body>
<?php
for($i=0; $i<=10; $i++)
{
?>
<div id="ver_on"><a href="#" onclick="mostrar('bloque'); return false;">Ver más</a></div>
<div id="ver_off" style="display: none"><a href="#" onclick="ocultar('bloque'); return false;">Ver menos</a></div>
<div id="bloque" style="display: none">Texto a mostrar u ocultar</div>
<?php
}
?>
</body>
</html>