0

function funcao1(){
    let email = document.getElementById('mail');

    let botao = document.getElementById('bot');

    let senha1 = document.getElementById('senha ');

    let teste = "[email protected]";

    if (email == teste) {

        window.location.href = "http://www.devmedia.com.br/";

    } else {
        alert('Deu ruim');

        alert(' Verifique se os campos foram colocados corretamente');
    }

}
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Netflix</title>
    <link rel="stylesheet" href="css/style.css" />
</head>
<header>
    <h1 id="log">NETFLIX</h1>
</header>
<body>
    <main>
        <h1 id="login">Login</h1>
        <br/><br/>
        <input id="mail" type="text" placeholder="Seu email aqui" />
        <br/><br/>
        <input id="senha" type="password" placeholder="Seu senha aqui" />
        <br/><br/><br/>
        <input class="bot " id="bot" type="button" onclick="funcao1()" value="Exibir Alert" />
    </main>
</body>
</html>

2
  • 1
    Como explicado no link indicado acima no box azul, faltou pegar o valor do campo: let email = document.getElementById('mail').value
    – hkotsubo
    12/04/2022 às 16:26
  • Valeu mano, ajudou muito.
    – zuba-px
    12/04/2022 às 16:28

0

Pesquise outras perguntas com a tag .