luishenriique

Untitled

Nov 2nd, 2013
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script language="JavaScript">
  2.     function enviar(){
  3.         if(document.getElementsByName('estado')[0].value == "0"){
  4.             alert('Selecione o estado');
  5.             return false;
  6.         }else{
  7.             alert('Funcionou'); // AQUI VOCÊ COLOCA O REDIRECIONAMENTO
  8.         }
  9.     }
  10. </script>
  11.  
  12. <form method="POST" onsubmit="return enviar()">
  13.     <select name="estado">
  14.         <option value="0">UF</option>
  15.         <option value="1">PR</option>
  16.     </select>
  17.     <input type="submit" />
  18. </form>
Advertisement
Add Comment
Please, Sign In to add comment