Ver Mensaje Individual
  #1 (permalink)  
Antiguo 10/05/2014, 08:38
Avatar de blancoarnau
blancoarnau
 
Fecha de Ingreso: junio-2013
Mensajes: 119
Antigüedad: 10 años, 11 meses
Puntos: 0
Intento crear un iframe pero no funciona

Hola a todos. Acabo de probar un pequeño código MUY sencillo pero no funciona. Se trata de la creación de un "iframe" con la dirección de la web que se escribe en un "input" de tipo "text". Echad un vistazo al JS:

Código Javascript:
Ver original
  1. function activarweb(){
  2.     var url = document.getElementById("text").value;
  3.     var iFrame = document.createElement("iframe");
  4.     iFrame.style.height = "100%";
  5.     iFrame.style.width = "100%";
  6.     iFrame.src = "http://" + url;
  7.     document.body.appendChild(iFrame);
  8. }

Y el HTML:

Código HTML:
Ver original
  1. <input type="text" id="text"><button onClick="activarweb()">Click</button>
  2. </form>

¿Alguna idea?