Ver Mensaje Individual
  #17 (permalink)  
Antiguo 05/08/2010, 14:30
jvmjunior
 
Fecha de Ingreso: marzo-2009
Mensajes: 62
Antigüedad: 15 años, 1 mes
Puntos: 0
Respuesta: Previsualizar enlace [SOLUCIONADO]

Hola...sigo trabajando en este proyectito y retomando el tema...

¿Como puedo hacer para que el iFrame se muestre siempre en el centro de la pantalla??

-> Ya que al mostrar más de 50 resultados en 3 columnas, la previsualización de los resultados del lado derecho no los puedo previsualizar, y tener que hacer un IF para cada coordenada no me parece correcto, sólo si no existiera más solución ;) <-

Muchas gracias de antemano

Cita:
Iniciado por Adler Ver Mensaje

Así te resultará mas sencillo

Código Javascript:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title></title>
  6. <script type="text/javascript">
  7. window.onload = function () {
  8. ligas = document.getElementById('enlaces').getElementsByTagName('A');
  9.     for(i= 0; i < ligas.length; i++) {
  10.         ligas[i].onmouseover = prev;
  11.         ligas[i].onmouseout = prev;
  12.     }  
  13. }
  14.  
  15.  
  16. function prev(evento){
  17. var evento = evento || window.event;
  18.     switch(evento.type) {
  19.     case 'mouseover':
  20.         window.c=document.createElement('div');
  21.                 c.style.position='absolute';
  22.                 var pos=getElementPosition.call(this);
  23.                 c.style.left=pos.left+150+'px';
  24.                 c.style.top=pos.top+10+'px';
  25.                 c.style.padding='2px';
  26.                 c.style.border='1px solid #000';
  27.                 c.innerHTML='<iframe width="500" height="300" frameborder="0" allowtransparency="true" src="'+this.href+'" />';
  28.                 document.body.appendChild(c);
  29.     break;
  30.  
  31.     case 'mouseout':
  32.         document.body.removeChild(window.c);    
  33.                 window.c=null;
  34.     break;
  35.     }
  36. }
  37.  
  38.  
  39. function getElementPosition() {
  40. var offsetTrail = this;
  41. var offsetLeft = 0;
  42. var offsetTop = 0;
  43.             while (offsetTrail) {
  44.                     offsetLeft += offsetTrail.offsetLeft;
  45.                     offsetTop += offsetTrail.offsetTop;
  46.                     offsetTrail = offsetTrail.offsetParent;
  47.             }
  48.             return {left:offsetLeft, top:offsetTop};
  49. }
  50. </script>
  51. </head>
  52.  
  53. <body>
  54. <div id="enlaces">
  55. <a id="caricatos" href="http://www.caricatos.net/">caricatos.net</a><br />
  56. <a id="forosweb" href="http://www.forosdelweb.com/">forosdelweb.com</a><br />
  57. <a id="desweb" href="http://www.desarrolloweb.com/">desarrolloweb.com</a>
  58. </div>
  59. </body>
  60. </html>

Suerte