Gerador de números para Mega-Sena
Publicado por Marcelo Oliver (última atualização em 28/06/2022)
[ Hits: 18.093 ]
Download 6361.MEGA_SENA-VOL.html
Download MEGA_SENA-V01-Jun_2022.html (versão 2)
Como o próprio título diz, gera 06 dezenas.
Comecei a ler um tutorial sobre JavaScript e tive a ideia de fazer esse "sorteador". Bastante simples. Gera um número, verifica se o mesmo já foi gerado anteriormente. Se SIM, despreza. Se NÃO, armazena e mostra.
Utilizo a quantidade de elementos da ARRAY como contador.
É isso...
Versão 2 - Enviado por Marcelo Oliver em 16/06/2022
Changelog: Dia desses encontrei esse meu "script", foi o meu primeiro em JS.....
Resolvi atualizar......
Download MEGA_SENA-V01-Jun_2022.html
<!DOCTYPE html> <meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/> <!-- Marcelo Oliver | Fevereiro/2016--> <html> <head> <title>MEGASENA</title> <style> div { width: 50%; margin: auto; border: 7.5px ridge yellow; } .msg { width: 90%; margin: auto; border: 0px ridge yellow; } .num { width: 90%; margin: auto; border: 0px ridge yellow; } .mod { background-color:black; color:yellow; text-align:center; float: left; margin: 7.5px; padding: 7.5px; width: 25px; border: 2.5px ridge yellow; } .button { background-color: white; border: double; color: black; padding: 2px 6px; text-align: center; text-decoration: none; display: inline-block; font-size: 16px; margin: 4px 2px; -webkit-transition-duration: 0.4s; /* Safari */ transition-duration: 0.5s; cursor: pointer; } .button1 { border-radius: 25px; } .button:hover { background-color: #555555; color: white; } .button:active { background-color: #555555; box-shadow: 0 5px #666; transform: translateY(4px); } a:link { color: yellow; background-color: transparent; text-decoration: none; } a:visited { color: yellow; background-color: transparent; text-decoration: none; } a:active { color: yellow; background-color: transparent; text-decoration: underline; } </style> </head> <body onload="GeraDez()"> <script> //DECLARAÇÃO DAS VAR's :) var NUM = [], stt, NEA, NN, str, STATUS, X = 6; function INICIO() { if (NEA) { document.getElementById("XX00").innerHTML = "AGUARDE . . ."; setTimeout(RELOAD, 1500); } else { MEGA();} } function GeraDez() { var W; var txt = " "; var NMR = [6,7,8,9,10,11,12,13,14,15]; for (W = 0; W < NMR.length; W++) { if (NMR[W] < 10) { NMR[W] = "0" + NMR[W]; } txt += "<div class='mod'>"+"<a href=javascript:pegadez("+NMR[W]+")>" + NMR[W] + "</a>" + "</div>"; } document.getElementById("00").innerHTML = txt; document.getElementById("XX00").innerHTML = " QUANTAS DEZENAS? "; } function pegadez(dez) { X = dez; } //INICIO MEGA function MEGA() { NN = (Math.floor(Math.random() * 60)+1); if (NN < 10) { NN = "0" + NN; } //CONVERTE ARRAY P/ STRING => se não usar o get, da erro... str = document.getElementById("H00").innerHTML = NUM.toString(); //LIMPA H00 document.getElementById("H00").innerHTML = ""; //VERIFICA SE NN JÁ FOI SORTEADO => pos É A POSIÇÃO DA STRING NA ARRAY, -1 É QDO NÃO ENCONTRA var pos = str.search(NN); if (pos == -1) { //ARMAZENA EM "ARRAY NUM" NUM.push(NN) //ENVIA PRA TELA document.getElementById("H01").innerHTML += "<hr>"+NN; //Nº de ARRAYS NEA = NUM.length; } if (NEA < X) { STATUS = "ON"; var LOOPING = setTimeout(MEGA, 750); } else { STATUS = "OFF"; var FIM = setTimeout(LHORIZ, 1000); } document.getElementById("00").innerHTML = " GERANDO PALPITES "; document.getElementById("XX00").innerHTML = " " + NEA + "ª " + "DEZENA"; } //FIM MEGA function RELOAD() { window.location.reload(true); } function LHORIZ() { document.getElementById("H01").innerHTML += "<hr>"; document.getElementById("XX00").innerHTML = "* BOA SORTE! *"; document.getElementById("XX01").innerHTML = "Se Ganhar, não esqueça do MSOLIVER. :)"; document.getElementById("00").innerHTML = ""; } </script> <br> <div align="center"> <h2 ID="XX00" style="color:black;"></h2> <!--h2 ID="XX00" style="color:black;">GERA PALPITES P/ MEGASENA</h2--> <div class='num'> <h3 id="00" align="center"></h3> </div> <!--p></p> <p></p--> <div class='msg'> <h2 ID="XX01" style="color:blue;"></h2> </div> <button class="button button1" onclick="INICIO()"><b>INICIAR</b></button> </div> <p id="H00"></p> <h1 id="H01" align="center"></h1> <h3 id="01" align="left" style="color:black;"></h3> </body> </html>
Cálculo de frete/correios utilizando Ajax
Javascript addDay(): Cálculo de data!
Notícias do site Ultimo Segundo
Passkeys: A Evolução da Autenticação Digital
Instalação de distro Linux em computadores, netbooks, etc, em rede com o Clonezilla
Título: Descobrindo o IP externo da VPN no Linux
Armazenando a senha de sua carteira Bitcoin de forma segura no Linux
Enviar mensagem ao usuário trabalhando com as opções do php.ini
Instalando Brave Browser no Linux Mint 22
vídeo pra quem quer saber como funciona Proteção de Memória:
Encontre seus arquivos facilmente com o Drill
Mouse Logitech MX Ergo Advanced Wireless Trackball no Linux
Compartilhamento de Rede com samba em modo Público/Anônimo de forma simples, rápido e fácil
Programa duplicado no "Abrir com" e na barra de pesquisa do ... (1)
VMs e Interfaces de Rede desapareceram (13)
Como abrir o pycharm no linux [RESOLVIDO] (4)