Ver Mensaje Individual
  #1 (permalink)  
Antiguo 10/05/2013, 16:51
Avatar de satjaen
satjaen
 
Fecha de Ingreso: septiembre-2012
Ubicación: Jaén (Andalucía)
Mensajes: 893
Antigüedad: 12 años, 5 meses
Puntos: 10
Ocultar un div si no existen registros.

Estoy intentando ocultar un div sin no existe ningún registro, pero no se como hacerlo. Por favor podeis ayudarme:

Código Javascript:
Ver original
  1. <script>
  2. function esconderDiv(){
  3.    
  4.         var eldiv=document.getElementById('div_3');
  5.        if(eldiv.innerHTML == ""){
  6.               eldiv.style.display = none;
  7.        
  8. }
  9. }
  10.  
  11. </script>  
  12. </head>
  13. <body onload="esconderDiv();">
  14.            
  15. <div id="div_3">
  16.  
  17. <ul data-role="listview" data-divider-theme="b" data-inset="true">
  18. <li data-role="list-divider" role="heading">[<?php echo $row_Recordset1['tecnico']; ?>]</li>
  19. <?php do { ?>
  20. <?php
  21.  
  22.  
  23. $fecha1 = strtotime($row_Recordset4['hora_entrada']);
  24. $fecha2 = strtotime($row_Recordset4['hora_salida']);
  25.  
  26. $diferencia_minutos = ($fecha2-$fecha1)/60;$min = ($fecha2-$fecha1)/60;  
  27.  
  28. ?>
  29. <li data-role="list-divider" role="heading"><?php echo $row_Recordset4['fecha']; ?></li>
  30. <li data-theme="c">
  31. De&nbsp;<?php echo $row_Recordset4['hora_entrada']; ?>&nbsp;a&nbsp;<?php echo $row_Recordset4['hora_salida']; ?><span class="ui-li-count"><?php echo ceil($diferencia_minutos);  ?>&nbsp;minutos</span></li>
  32. <?php } while ($row_Recordset4 = mysql_fetch_assoc($Recordset4)); ?>
  33.  
  34.  
  35.  
  36.                                   </ul>
  37.  
  38. </div>

Muchas gracias