Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

192
Visualizações
Form in an iframe is not define : Edge issue

setting value to a form in iframe and submit the form.

window.frames['equityIFrame'].document.forms[0].[actionParam] = "equityAction";
window.frames['equityIFrame'].document.forms[0].submit();

This code works fine in IE and other browser.

In Edge browser, throws the below error.

cannot read the property 'forms' of undefined.

What will be the work around for this.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You can use HTMLIFrameElement.contentWindow to access the iframe's document and its internal DOM. You can refer to my sample code below, it works well in Edge and other browsers:

iframe.html:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title></title>
</head>
<body>
    <iframe src="form.html" id="test"></iframe>
    <input type="button" value="click" onclick="ChangeIframe()" />
    <script>
        function ChangeIframe() {
            document.getElementById("test").contentWindow.document.getElementById("fname").value = "myname";
            document.getElementById("test").contentWindow.document.forms[0].submit();
        }
    </script>
</body>
</html>

form.html:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title></title>
</head>
<body>
    <form action="index.html" method="get">
        <label for="fname">First name:</label>
        <input type="text" id="fname" name="fname"><br><br>
        <label for="lname">Last name:</label>
        <input type="text" id="lname" name="lname"><br><br>
        <input type="submit" value="Submit">
    </form>
</body>
</html>
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda