Ver Mensaje Individual
  #5 (permalink)  
Antiguo 11/03/2008, 09:53
ryuk
 
Fecha de Ingreso: septiembre-2007
Mensajes: 83
Antigüedad: 16 años, 7 meses
Puntos: 0
Re: Problema al Refrescar div

bueno para explicar mejor aqui esta el codigo:

Código PHP:
<?php
    
include('cnx/conexion2.php');
    
    @
$qry_id=mysql_query("select * from temas where id_tema='$_REQUEST[dsc]'") or die("Hubo un Error al Obtener la ID");
    
$xid=mysql_fetch_array($qry_id);
    
    
$qry_1=mysql_query("SELECT * FROM temas where id_tema_raiz='$xid[id_tema]' ORDER BY descripcion");


    
$num_resultados mysql_num_rows($qry_1) + 1;
    
    print 
var_dump($num_resultados);
    
    for (
$x=1$x <$num_resultados$x++)
    {
    
$row_ctg mysql_fetch_array($qry_1);
    
?>    
<script language="Javascript">
    
        var idv;
        var ido;
        var cajav;
        var cajao;
        var imgv;
        var imgo;
        var mostrar;
        
    function mostrar<?php print $x?>() {
    
        idv = document.getElementById("<?php print 'idv'.$x?>");
        ido = document.getElementById("<?php print 'ido'.$x?>");
        cajav = document.getElementById("<?php print 'cajav'.$x?>");
        cajao = document.getElementById("<?php print 'cajao'.$x?>");
        imgv = document.getElementById("<?php print 'imgv'.$x?>");
        imgo = document.getElementById("<?php print 'imgo'.$x?>");                

        if(ido.style.display == "none") {
            ido.style.display = "inline";
            idv.style.display = "none";
            cajav.style.display = "none";
            cajao.style.display = "inline";
            imgo.style.display = "inline";
            imgv.style.display = "none";                        
        }

    }
    
    function ocultar<?php print $x?>() {

        idv = document.getElementById("<?php print 'idv'.$x?>");
        ido = document.getElementById("<?php print 'ido'.$x?>");
        cajav = document.getElementById("<?php print 'cajav'.$x?>");
        cajao = document.getElementById("<?php print 'cajao'.$x?>");
        imgv = document.getElementById("<?php print 'imgv'.$x?>");
        imgo = document.getElementById("<?php print 'imgo'.$x?>");                

        if(cajao.style.display == "inline") {
            ido.style.display = "none";
            idv.style.display = "inline";
            cajav.style.display = "inline";
            cajao.style.display = "none";
            imgo.style.display = "none";
            imgv.style.display = "inline";                        
        }

    }
</script>

<!--Div visible--->

    <div id="<?php print 'idv'.$x?>" style="display:inline;    border:1px dashed #CCC;    width:30px;    height:25px;    position:relative;    float:left;    margin-top:3px;    margin-right:5px; margin-left:3px; text-align:center; clear:both; padding:0px">
        <?php print $x?>    </div>    

    <div id="<?php print 'cajav'.$x?>" style="display:inline;    border:1px dashed #CCC;    width:470px; height:25px; position:relative; float:left; margin-top:3px; margin-right:5px; margin-left:5px;">
        <label id="name_categoria" ><?php print $row_ctg['descripcion']; ?></label>    
    </div>
<!--Fin de Div visible--->
<!--Div Oculto-->
    
    <div id="<?php print 'ido'.$x?>" style="display:none;    border:1px dashed #CCC;    width:30px;    height:25px;    position:relative;    float:left;    margin-top:3px;    margin-right:5px; margin-left:3px; text-align:center; clear:both">
        <?php print $x?>
    </div>
    
    <div id="<?php print 'cajao'.$x?>" style="display:none;    border:1px dashed #CCC;    width:470px; height:25px; position:relative; float:left; margin-top:3px; margin-right:5px; margin-left:5px;">
        <label id="name_categoria" ><input type="text" value="<?php print $row_ctg['descripcion']; ?>" name="txt_categoria" id="txt_categoria" /></label>    
    
    </div>
<!--Fin d Div Oculto-->


    <div id="t_mantenimiento">
    
        <img src="images/save.gif" height="20px" width="20px" />
        <a id="mostrar" href="javascript:mostrar<?php print $x?>();">
        <img src="images/editar.gif"  height="20px" width="20px" id="<?php print 'imgv'.$x?>"/>
        </a>
        <a id="mostrar" href="javascript:ocultar<?php print $x?>();">
        <img src="images/conf_edit.gif"  height="20px" width="20px" id="<?php print 'imgo'.$x?>" style="display:none"/>
        </a>        
    </div>
    <div id="t_mantenimiento" style="height:25px"><input type="checkbox" name="" /></div>    
<?php
    
}
    
mysql_free_result($qry_1);
?>
cuando se carga por primera vez la pagina digamos que mi bucle sea de 6 registros ... funciona de lo mas bien pero cuando le envio la nueva variable $_REQUEST[dsc] y digamos se genere un bucle de 8, imprime los 8 registros pero solo 6 funciones javascritp funcionan

saludos...