Ver Mensaje Individual
  #10 (permalink)  
Antiguo 11/12/2010, 11:28
Avatar de emprear
emprear
Colaborador
 
Fecha de Ingreso: junio-2007
Ubicación: me mudé
Mensajes: 8.388
Antigüedad: 16 años, 9 meses
Puntos: 1567
Respuesta: Ayuda en codigo para popup

danip1983:

Primero te advierto que tu sistema tiene algunas inconsistencias, tené en cuenta que muchos de los navegadores vienen configurados para abrir las nuevas ventanas (target='_blank') en un nueva pestaña, por lo cual no verías las ventanas multiples al mismo tiempo, que sería lo aconsejable.
Por otro lado estás abriendo directamente la imagen como destino del link, y lo ideal sería que fuese un html que contenga un <img>.

De todas maneras te doy una técnica par ahacer lo que quieres


Esta es la página que abre el pop_up

abrir_popup.html

Código HTML:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>Abrir Popup</title>
  6. <script type="text/javascript">
  7. //<![CDATA[
  8. var win= null;
  9. function VentanaCentrada(pagina,w,h,nombre){
  10. var winleft = (screen.width-w)/2;
  11. var wintop = (screen.height-h)/2;
  12. caracteristicas='height='+h+',width='+w+',top='+wintop+',left='+winleft+',scrollbars=no,toolbar=no,resizable=yes'
  13. win=window.open(pagina,nombre,caracteristicas)
  14. if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
  15. }
  16. //]]>
  17. </head>
  18. <a href="html2.html" onclick="VentanaCentrada('html2.html','400','400','Popupuno');return false;" > Abrir Popup </a>
  19. </body>
  20. </html>


esta es el pop up
html2.html


Código HTML:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es" lang="es" >
  4. <title>XHTML 1.0 transitional</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6. </head>
  7. <p>Este es el popup</p>
  8. <a href="img.html" target="_blank">mostrar publicidad</a>
  9. </body>
  10. </html>


y este el html que contiene la imagen y a su vez cierra el popup

Código HTML:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es" lang="es" >
  4. <title>Publicidad</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6. <script type="text/javascript">
  7. //<![CDATA[
  8. self.opener.close();
  9. //]]>
  10. </head>
  11. <p>Aqui iría la imagen</p>
  12. </body>
  13. </html>



La solución ideal sería que tu html con la imagen sea un nuevo popup generados desde el primer popup


Saludos
__________________
La voz de las antenas va, sustituyendo a Dios.
Cuando finalice la mutación, nueva edad media habrá
S.R.