Ver Mensaje Individual
  #4 (permalink)  
Antiguo 02/04/2010, 13:04
Avatar de Adler
Adler
Colaborador
 
Fecha de Ingreso: diciembre-2006
Mensajes: 4.671
Antigüedad: 18 años, 2 meses
Puntos: 126
Respuesta: Un formularios con ayuda

Hola

Veamos un ejemplo practico

Abrir_popup.html

Código javascript:
Ver original
  1. <html>
  2. <head>
  3. <script type="text/javascript">
  4. function abrir () {
  5. var ancho = parseInt(((screen.width) / 2) - 150);
  6. var alto = parseInt(((screen.height) / 2) - 150);
  7. window.open('insertar_datos_desdepopup.php','popup','resizable=yes, top='+alto+', left='+ancho+', width=300 ,height=300,  menubar=no, scrollbars=no, status=no, titlebar=no, toolbar=no,directories=no');
  8. }
  9. </script>
  10. </head>
  11. <body>
  12. <a href="javascript:void(0);" target="popup" hreflang="es" title="Imagen del Producto" onclick="abrir();">Abrir POPUP</a><br /><br />
  13. <form name="form1">
  14. Razon: <input type="text" id="camp1" name="camp1" value="" /><br />
  15. Cliente: <input type="text" id="camp2" name="camp2" value="" /><br />
  16. Calle: <input type="text" id="camp3" name="camp3" value="" />
  17. </body>
  18. </html>

insertar_datos_desdepopup.php

Código PHP:
Ver original
  1. <?php
  2. $razon = "Por que quiero";
  3. $cliente = 12;
  4. $calle = "Italia";
  5. ?>
  6. <html>
  7. <head>
  8. <script type="text/javascript">
  9. function enviar_datos_cliente(){
  10.         window.opener.document.form1.camp1.value ="<?php echo $razon?>";        
  11.         window.opener.document.form1.camp2.value ="<?php echo $cliente?>";            
  12.         window.opener.document.form1.camp3.value ="<?php echo $calle?>";
  13. self.close()
  14. }
  15.  
  16. </script>
  17. </head>
  18. <body>
  19. Estos serán los datos que se enviarán al form<br />
  20. Razon: <?php echo $razon?><br />
  21. Cliente: <?php echo $cliente?><br />
  22. Calle: <?php echo $calle?><br /><br />
  23. <a href="#na" target="popup" hreflang="es" title="Imagen del Producto" onclick="enviar_datos_cliente();">Enviar Datos Al Form</a>
  24. </body>
  25. </html>

Suerte
__________________
Los formularios se envían/validan con un botón Submit
<input type="submit" value="Enviar" style="background-color:#0B5795; font:bold 10px verdana; color:#FFF;" />