Gerador de números para Mega-Sena
Publicado por Marcelo Oliver (última atualização em 28/06/2022)
[ Hits: 18.526 ]
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>
Simplificando ao extremo o carrossel
Adicionar/Remover Classe de um Elemento HTML
Cirurgia para acelerar o openSUSE em HD externo via USB
Void Server como Domain Control
Modo Simples de Baixar e Usar o bash-completion
Monitorando o Preço do Bitcoin ou sua Cripto Favorita em Tempo Real com um Widget Flutuante
[Resolvido] VirtualBox can't enable the AMD-V extension
Como verificar a saúde dos discos no Linux
Como instalar , particionar, formatar e montar um HD adicional no Linux?
Como automatizar sua instalação do Ubuntu para desenvolvimento de software.
Fiz uma pergunta no fórum mas não consigo localizar (18)
Não consigo instalar distro antiga no virtualbox nem direto no hd (9)
Quais os códigos mais dificeis que vcs sabem fazer? (5)
Upscaling com imagem cortada no monitor secundário ao usar iGPU Multi ... (1)
Servidor Ubuntu 24.04 HD 500 não tenho espaço na \home\adminis... [RES... (8)









