SHARE
TWEET

Untitled

a guest Aug 19th, 2019 100 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <form action="paginas/login.php">
  2.     <p id="log">Usuário: </p> <input id="cmpG" type="text" name="usuario"/>
  3.     <p id="log">Senha: </p> <input id="cmpG" type="password" name="senha" size=8 maxlength=8/>
  4.     <p id="log">A senha deve conter 08 caracteres (alfanumerico)</p>
  5.     <!-- Barra de botões -->
  6.     <div id="barra">
  7.         <input id="bnt" type="submit" value="Login"/>
  8.         <input id="bnt" type="reset" value="Limpar"/>
  9.         <BUTTON >Cadastrar</BUTTON>
  10.     </div>
  11. </form>
  12.      
  13. <div id="barra">
  14.     <input class="bnt" name="" type="submit" value="login"/>
  15.     <input class="bnt" type="submit" value="cadastrar"/>
  16.     <input class="bnt" type="reset" value="Limpar"/>
  17. </div>
  18.      
  19. var form = document.querySelector('form');
  20. var inputDiv = document.getElementById('barra');
  21. var urls = {
  22.     cadastrar: 'paginas/cadastro.php',
  23.     login: 'paginas/login.php'
  24. };
  25. function verificarDestino(e){
  26.     e.preventDefault();
  27.     console.log(e.target);
  28.     var tipo = e.target.value;
  29.     var url = urls[tipo];
  30.     form.action = url;
  31.     alert(url); // só para verificar
  32.     form.submit();
  33. }
  34. inputDiv.addEventListener('click', verificarDestino);
  35.      
  36. <div id="barra">
  37.     <input class="bnt" type="submit" value ="Login" formaction="paginas/login.php"/>
  38.     <input class="bnt" type="submit" value ="Cadastrar" formaction="paginas/cadastro.php"/>
  39.     <input class="bnt" type="reset" value="Limpar"/>
  40. </div>
  41.      
  42. <form action="paginas/login.php">
  43.     <p id="log">Usuário: </p> <input id="cmpG" type="text" name="usuario"/>
  44.     <p id="log">Senha: </p> <input id="cmpG" type="password" name="senha" size=8 maxlength=8/>
  45.     <p id="log">A senha deve conter 08 caracteres (alfanumerico)</p>
  46.     <!-- Barra de botões -->
  47.     <div id="barra">
  48.         <input id="bnt" type="submit" value="Login"/></a>
  49.         <input id="bnt" type="reset" value="Limpar"/>
  50.     </div>
  51. </form>
  52. <form action="paginas/cadastrar.php">
  53.     <BUTTON >Cadastrar</BUTTON>
  54. </form>
  55.      
  56. <BUTTON onclick="window.location.href='paginas/cadastrar.php'">Cadastrar</BUTTON>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top