Ver Mensaje Individual
  #2 (permalink)  
Antiguo 20/11/2014, 14:56
daxxdj
 
Fecha de Ingreso: abril-2011
Mensajes: 41
Antigüedad: 13 años
Puntos: 2
Respuesta: Rellenar formularios en iframes

Bueno, lo he solucionado, los codes quedan tal que así:

Código Javascript:
Ver original
  1. <script type="text/javascript">        
  2.             function func_fram1() {
  3.                 var fram1 = document.getElementById('fram1');
  4.                 var oDoc1 = (fram1.contentWindow || fram1.contentDocument);
  5.                 if (oDoc1.document) oDoc1 = oDoc1.document;
  6.                 oDoc1.getElementById('username').value='valor';
  7.                 oDoc1.getElementById('password').value='valor';
  8.                 oDoc1.getElementById("loginform").submit();
  9.             }
  10.             function func_fram2() {
  11.                 var fram2 = document.getElementById('fram2');
  12.                 var oDoc2 = (fram2.contentWindow || fram2.contentDocument);
  13.                 if (oDoc2.document) oDoc2 = oDoc2.document;
  14.                 oDoc2.getElementById('username').value='valor';
  15.                 oDoc2.getElementById('password').value='valor';
  16.                 oDoc2.getElementById("loginform").submit();
  17.             }
  18.         </script>

Código HTML:
Ver original
  1. <iframe name="fram1" id="fram1" src="paga.html" onload="func_fram1()"></iframe>
  2. <iframe name="fram2" id="fram2" src="pagb.html" onload="func_fram2()"></iframe>

Código HTML:
Ver original
  1. <form id="loginform" method="post" action="[URL]/login.php">
  2.     <input type="text" name="username" id="username" />
  3.     <input type="password" name="password" id="password" maxlength="64"/>
  4.     <input type="submit" value=" Login" />
  5. </form>

Ni va muy fino ni funciona en todos los navegadores, pero sin tener ni idea de javascript es lo que hay... Saludos!