Jump to content
Fórum Script Brasil
  • 0

Redirecionamento da pagina não funciona


Question

Boa tarde,

Não estou conseguindo fazer este redirecionamento de pagina,consegui fazer na primeira vez normalmente.

mas depois que introduzi o bootstrap não consigo utilizar este comando.

segue os codigos:

index.html

<!DOCTYPE html>
<html lang="pt">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script type="text/javascript" src="main.js"></script>
    <meta>
    <title>Teste</title>
</head>
<body>
 
    <form>
    
   <input type='text' id='nome' >
   <input type="password" id='senha'>
    <button onclick="teste();"> Teste</button>
    </form>
 
</body>
</html>

teste.html

<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script type="text/javascript" src="main.js"></script>
<!------ Include the above in your HEAD tag ---------->
 
<!doctype html>
<html lang="en">
<head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    
    <!-- Fonts -->
    <link rel="dns-prefetch" href="https://fonts.gstatic.com">
    <link href="https://fonts.googleapis.com/css?family=Raleway:300,400,600" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="main.js"></script>
 
    <link rel="icon" href="Favicon.png">
 
    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
    <script type="text/javascript" src="main.js"></script>
    <title>Laravel</title>
</head>
<body>
 
<nav class="navbar navbar-expand-lg navbar-light navbar-laravel">
    <div class="container">
        <a class="navbar-brand" href="#">Laravel</a>
        <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
        </button>
 
        <div class="collapse navbar-collapse" id="navbarSupportedContent">
            <ul class="navbar-nav ml-auto">
                <li class="nav-item">
                    <a class="nav-link" href="#">Login</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="#">Register</a>
                </li>
            </ul>
 
        </div>
    </div>
</nav>
 
<main class="login-form">
    <div class="cotainer">
        <div class="row justify-content-center">
            <div class="col-md-8">
                <div class="card">
                    <div class="card-header">Register</div>
                    <div class="card-body">
                        <form action="" method="">
                            <div class="form-group row">
                                <label for="email_address" class="col-md-4 col-form-label text-md-right">E-Mail Address</label>
                                <div class="col-md-6">
                                    <input type="text" id="email_address" class="form-control" name="email-address" required autofocus>
                                </div>
                            </div>
 
                            <div class="form-group row">
                                <label for="password" class="col-md-4 col-form-label text-md-right">Password</label>
                                <div class="col-md-6">
                                    <input type="password" id="password" class="form-control" name="password" required>
                                </div>
                            </div>
 
                            <div class="form-group row">
                                <div class="col-md-6 offset-md-4">
                                    <div class="checkbox">
                                        <label>
                                            <input type="checkbox" name="remember"> Remember Me
                                        </label>
                                    </div>
                                </div>
                            </div>
 
                            <div class="col-md-6 offset-md-4">
                                <button type="submit" onclick="teste2();" class="btn btn-primary">
                                    Register
                                </button>
                                <a href="#" class="btn btn-link">
                                    Forgot Your Password?
                                </a>
                            </div>
                    </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
    </div>
 
</main>






 
</body>
</html>

JAVASCRIPT.html -> que deveria fazer a função

function teste()
{
    var nome = document.getElementById("nome").value;
    var senha = document.getElementById("senha").value;
   
    if(nome == 'admin' && senha == '12345' )   //validação
    {
        window.location.replace("https://www.google.com"); //transferir pagina
        
    }
 
}
 
function teste2()
{
   var email = document.getElementById("email_address").value;


 
 if(email == 'administrador')
 {
    window.location.href = "http://pt.stackoverflow.com";
 }
   
 
    
 
}

 

alguém PODERIA ME INFORMAR ONDE EU ESTOU ERRANDO?OBRIGADO

 

 

 

 

Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      148687
    • Total Posts
      644519
×
×
  • Create New...