Ver Mensaje Individual
  #2 (permalink)  
Antiguo 03/09/2011, 21:23
Avatar de Naahuel
Naahuel
 
Fecha de Ingreso: marzo-2011
Ubicación: localhost
Mensajes: 796
Antigüedad: 13 años, 2 meses
Puntos: 192
Respuesta: Cerrar iframe con codigo interior.

No es algo muy bueno, pero bué... Dudo que tenga buena compatibilidad. Esto parece funcionar:


Documento Padre:

Código HTML:
Ver original
  1. <!DOCTYPE html>
  2.   function _ocultarIframe(){
  3.     document.getElementById('test').style.display = 'none'
  4.   }  
  5. </head>
  6.   <iframe id="test" src="http://jsbin.com/ediwem">
  7.  
  8.   </iframe>
  9. </body>
  10. </html>


Documento en el iframe:

Código HTML:
Ver original
  1. <!DOCTYPE html>
  2.   function _enviarAlPadre(){
  3.    window.parent._ocultarIframe();
  4.   }
  5.  </script>
  6. </head>
  7.   <a onclick="_enviarAlPadre()" href="#">Click para ocultar este iframe</a>
  8. </body>
  9. </html>


Acá lo podés ver en funcionamiento: http://jsbin.com/isixaj
__________________
nahueljose.com.ar