Ver Mensaje Individual
  #3 (permalink)  
Antiguo 30/03/2008, 14:41
Rebe22
 
Fecha de Ingreso: octubre-2006
Mensajes: 128
Antigüedad: 17 años, 7 meses
Puntos: 1
Re: Ayuda con Iframes

hola y gracias por contestarme!

La verdad es que me estoy volviendo loca.... y con lo que me dices me devuelve vacío.... mira te enseño el código de los dos iframes.... a ver si ves algo que esté haciendo mal...

Este es el iframe superior
Código PHP:
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Laboratorio de Electrónica</title>
<style type="text/css">
<!--
body {
    background-color: #C2D0DC;
    
}
.Estilo1 {color: midnightblue}
#capa_CI {    position:absolute;
    width:924px;
    height:89px;
    z-index:3;
    left: 294px;
    top: 122px;
    visibility: hidden;
}
-->
</style>
<script language="javascript">  
function solonumeros(e){
                tecla = (document.all) ? e.keyCode : e.which;
                if (event.keyCode < 48 || event.keyCode > 57)
                 event.returnValue =false;
                 
                
            
            }
            
function damevalor(){
/* Esta función devolverá el valor elegido en el combo práctica para poder enviar el código de la práctica */
    var variable = document.getElementById('practica');  
    valor = variable.options[variable.selectedIndex].text;  
    document.getElementById("campo2").value=valor;  

}


function datos(){  
    var variable = document.getElementById('practica');  
    valor = variable.options[variable.selectedIndex].text;  

    if (variable.selectedIndex!='0'){  
        var index=document.forms.formulario.practica.selectedIndex;  
        document.getElementById("campo1").value=valor;  

                document.forms.formulario.submit();  
    }else{  
                
        document.getElementById('practica').selectedIndex= '0';
        document.getElementById("asignatura").value='';
        document.getElementById("alumnos").value='';
        document.getElementById("puestos").value='';
          
    } 
     
}  


</script>  
</head>  
<body>  
<table width="100%" border="0">  
<tr>  
    <th scope="col">&nbsp;</th>  
</tr>  
<tr>  
    <th scope="row"> 
        <span class="Estilo1"> 
            Seleccione la pr&aacute;ctica que desee y el kit de pr&aacute;ctica que necesitar&iacute;a para su realizaci&oacute;n        </span>    </th>  
</tr>  
<tr>  
    <th scope="row">&nbsp;</th>  
</tr> 
<tr> 
    <th scope="row"> 
      <form method="post" name="formulario">  
            <fieldset style="border:#000066" style="font-weight:100">  
                <legend>Datos del kit</legend>  
              <p align="left"><strong> 
<?php    
    $link
=mysql_connect("localhost","root","");   
    
mysql_select_db("laboratorio",$link);   
    
$consultamysql_query("SELECT cod_practica,asignatura,titulo_practica from practica");   
    
$numero_registros=mysql_num_rows($consulta);  
    
mysql_close ($link); 
?><span class="Estilo1"> Seleccione la práctica:</span>  
                <select name="envia" onchange="datos()" id="practica">  
                    <option>Seleccionar </option>  
<?php 
    
while ($fila mysql_fetch_assoc($consulta)){  
        if(
$fila["titulo_practica"] == $_POST['envia']){ 
            
$selected "selected"
        }else{ 
            
$selected ""
        } 
?>  
                    <option <?php echo $selected?><?php echo $fila["titulo_practica"];  ?> </option> <?php 
    

    
                  
    
?>  
                </select>  
                <input type="hidden" name="campo1" id="campo1"/>
    <?php    
//Nos guardamos el código de la practica
  
$link=mysql_connect("localhost","root","");   
    
mysql_select_db("laboratorio",$link);   
    
$consultamysql_query("SELECT cod_practica from practica where titulo_practica = '$campo1'");
    
$row mysql_fetch_array ($consulta);
    echo 
"<input type='hidden' name='codigo_practica' id='codigo_practica' value='$row[1]'> \n"

?>&nbsp;<span class="Estilo1">Asignatura:</span>
                <?php   
    $campo_busqueda
$_POST['campo1'];  
    
$link=mysql_connect("localhost","root","");   
    
mysql_select_db("laboratorio",$link);   
    
$consultamysql_query("SELECT asignatura,numero_alumnos,num_persopuesto from practica where titulo_practica='$campo_busqueda'");  
    
$row mysql_fetch_row($consulta);  
    echo 
"<input name='asignatura' type='text' id='asignatura' disabled='true' size='20' value='$row[0]'>\n"  

?><span class="Estilo1">N&uacute;mero Alumnos:</span><?php   
    
echo "<input name='alumnos' type='text' id='alumnos' disabled='true' size='1' value='$row[1]'>\n"  
?><span class="Estilo1">N&uacute;mero Puestos: </span>
  <?php   
    
echo "<input name='alumnos' type='text' id='puestos' disabled='true' size='1' value='$row[2]'>\n"  
?>
  </strong></p>
              <p align="left"><strong><br />
                  </strong>
                </fieldset>  
                    </p>
      </form>    
      
      <form action="kit_practica_4.php" name="formulario_cosas">
          
        <input type="hidden" name="practica" id="practica" value=<?php $campo_busqueda?> />
          
      </form>
    

</body> 
</html>
Este es el inferior
Código PHP:
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Laboratorio de Electrónica</title>
<style type="text/css">
<!--
body {
    background-color: #C2D0DC;
    
}
.Estilo1 {color: midnightblue}
#capa_CI {    position:absolute;
    width:924px;
    height:89px;
    z-index:3;
    left: 294px;
    top: 122px;
    visibility: hidden;
}
-->
</style>

<script language="javascript">  

function datos(){

var val = window.parent.frames["kit_superior"].document.getElementById("practica").value;
alert(val);


}



</script>

<body>


<?php
    
    
echo "mi practica es:";
    echo 
$campo2;    
    
$link=mysql_connect("localhost","root","");
    
mysql_select_db("laboratorio",$link);    
    
    
$result mysql_query("SELECT * FROM kit where Practica = 'Toma de contacto'");
    echo 
"<br>";    
    echo 
"<table border = '0' align='center' class='Estilo1'> \n";
    echo 
"<tr> \n";
    echo 
"<td><b>Componentes actuales del kit: </b></td> \n";
    
    echo 
"<tr> \n";
    
    echo 
"<tr> \n";
    
    echo 
"<tr> \n";
    
    echo 
"</table> \n";

    echo 
"<table border = '1' bordercolordark='#000066' align='center' class = 'Estilo'> \n";

    echo 
"<tr> \n";

    echo 
"<td align= 'center' class = 'Estilo1'><b>Componente</b></td> \n";

    echo 
"<td align= 'center'  class = 'Estilo1'><b>Unidades</b></td> \n";

    echo 
"<td colspan='2' align= 'center'  class = 'Estilo1'> <b> Botones </b></td> \n";

    echo 
"</tr> \n";

    while (
$row mysql_fetch_row($result)){
        
        echo 
"<tr> \n";
    
        echo 
"<td>$row[0]</td> \n";

        echo 
"<td>$row[1]</td> \n";
        echo 
"</form> \n";
        
        echo 
"</tr> \n";
    }
    echo 
"<tr> \n";
       
      
?>
    
      
      
      
        <th scope="row"><div align="center">
    <form name="formulario2" method="post" action="anadir_kit.php" onmouseover="datos();">
         
    <select name="componentes" id="componentes" onchange="document.getElementById('codcomponente').value=this.options[this.selectedIndex].value">

 
<?php 
                       
//OBTENER LOS VALORES DE LAS FILAS 
    
$sql "SELECT codigo_componente, componente, Desc1, Desc2, Comentario FROM componentes ORDER BY codigo_componente ASC"
    
$resul mysql_query($sql$link) or die ( mysql_error() ); 
    
$opt '<option value = "%s">%s %s %s %s</option>'

// El especificador s del sprintf presenta una cadena de caracteres.
             
//RECORRIDO DEL CURSOR 
while($row mysql_fetch_array($resul)) 
{  
   echo 
sprintf($opt$row[0],  $row[1], $row[2], $row[3], $row[4]); 

           
?> 
 </select></td> 

 </select></td> 

                
                
         
           
        </div></th>
        <td><div align="center">
          <input name="desc1" type="text" id="desc1" />
        </div></td>
        <td><div align="center">
          <input type="submit" name="Alta" value="Alta"/>
          
        </div></td>
       </form>
       
      </tr>
      <tr></tr>
      
  
</table>




</table></body> 
</html>
Y este es el que tiene los dos....
Código PHP:
html xmlns="http://www.w3.org/1999/xhtml">
<
head>
<
meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<
title>Documento sin t&iacute;tulo</title>
<
style type="text/css">
<!--
body {
    
background-color#C2D0DC;
}
-->
</
style></head>

<
body>

<
iframe src="kit_superior.php" width="100%" height="200px" scrolling="no" frameborder="0" id="kit_superior" name="kit_superior">
</
iframe>

<
iframe src="kit_practica_4.php" width="100%" height="700px" scrolling="auto" frameborder="0" id="kit_practica_4" name="kit_practica_4">
</
iframe>
</
body>
</
html
Cuando hago el alert con lo que me has dicho...me devuelve vacío... ¿sabes q puede pasar?

MUCHAS GRACIAS!