Ayuda: Script que autocompleta formularios externos

  • Autor Autor jhonlozanot
  • Fecha de inicio Fecha de inicio
jhonlozanot

jhonlozanot

VIP
Eta
Verificado
Verificación en dos pasos activada
Verificado por Whatsapp
Verificado por Binance
Suscripción a IA
Tengo un script JS que para ayudarme a automatizar formularios los inserta pero solo me funcionada con navegadores explorer, edge y no con Chrome, alguna ayuda para hacerlo funcionar.

Dejo el codigo:

JavaScript:
<script type="text/javascript">         
            function func_fram1() {
                var fram1 = document.getElementById('fram1');
                var oDoc1 = (fram1.contentWindow || fram1.contentDocument);
                if (oDoc1.document) oDoc1 = oDoc1.document;
                oDoc1.getElementById('username').value='valor';
                oDoc1.getElementById('password').value='valor';
                oDoc1.getElementById("loginform").submit();
            }
            function func_fram2() {
                var fram2 = document.getElementById('fram2');
                var oDoc2 = (fram2.contentWindow || fram2.contentDocument);
                if (oDoc2.document) oDoc2 = oDoc2.document;
                oDoc2.getElementById('username').value='valor';
                oDoc2.getElementById('password').value='valor';
                oDoc2.getElementById("loginform").submit();
            }
        </script>


Estos son mis dos iframes con los mismos formularios:

Insertar CODE, HTML o PHP:
<iframe name="fram1" id="fram1" src="paga.html" onload="func_fram1()"></iframe>
<iframe name="fram2" id="fram2" src="pagb.html" onload="func_fram2()"></iframe>

Los formularios en si

Insertar CODE, HTML o PHP:
<form id="loginform" method="post" action="[URL]/login.php">
    <input type="text" name="username" id="username" />
    <input type="password" name="password" id="password" maxlength="64"/>
    <input type="submit" value=" Login" />
</form>
 
Puedes intentar usando Jquery.
 
Atrás
Arriba