Skip to content

Commit

Permalink
1 file edited
Browse files Browse the repository at this point in the history
  • Loading branch information
Croc-Prog-github authored May 12, 2024
1 parent 04abbff commit 9bed3ec
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions game/multiP/onlineUser.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@
<button style="margin-inline: 5px;border: solid 1px black;border-bottom: solid 2px black;border-radius: 3px;text-shadow: 0px 1.4px 0px black;box-shadow: 0 2px 1px 0px #0000004d;color: white;background: dodgerblue;text-transform: uppercase;/*font-weight: bold;*/ cursor: pointer;">Entra con codice</button>
</div>

<input type="text" maxlength="6" id="SquadInp" autocomplete="off" placeholder="ABC123" style="margin-top: 10px; width: 50%; font-size: 1.5em; text-transform: uppercase; user-select: all; outline-style: none; letter-spacing: 6px; text-align: center; font-weight: bold;">
<input type="text" maxlength="6" id="SquadInp" oninput="ToggleButton();" autocomplete="off" placeholder="ABC123" style="margin-top: 10px; width: 50%; font-size: 1.5em; text-transform: uppercase; user-select: all; outline-style: none; letter-spacing: 6px; text-align: center; font-weight: bold;">

<div style="display: flex; margin-top: 0.5em;">
<button hidden id="EsciDaSquad" style="margin-inline: 5px;border: solid 1px black;border-bottom: solid 2px black;border-radius: 3px;text-shadow: 0px 1.4px 0px black;box-shadow: 0 2px 1px 0px #0000004d;color: white; background: indianred; text-transform: uppercase;/*font-weight: bold;*/ cursor: pointer;">Esci dalla squadra</button>
<button hidden id="EntraInSquad" onclick="ControlFormato()" style="margin-inline: 5px;border: solid 1px black;border-bottom: solid 2px black;border-radius: 3px;text-shadow: 0px 1.4px 0px black;box-shadow: 0 2px 1px 0px #0000004d;color: white; background: mediumseagreen; text-transform: uppercase;/*font-weight: bold;*/ cursor: pointer;">Entra nella squadra</button>
<button hidden id="EntraNellaSquadra" onclick="ControlFormato()" style="margin-inline: 5px;border: solid 1px black;border-bottom: solid 2px black;border-radius: 3px;text-shadow: 0px 1.4px 0px black;box-shadow: 0 2px 1px 0px #0000004d;color: white; background: mediumseagreen; text-transform: uppercase;/*font-weight: bold;*/ cursor: pointer;">Entra nella squadra</button>
</div>
</div>

Expand All @@ -84,22 +84,21 @@
</html>

<script> // Mostra/Nasconde EntraInSquad e verifica formato
document.getElementById('SquadInp').addEventListener('input', EntraInSquad);
let SquadInp = document.getElementById('SquadInp');
let EntraInSquad = document.getElementById('EntraInSquad');
let EntraNellaSquadra = document.getElementById('EntraNellaSquadra');

function EntraInSquad() {
function ToggleButton() {
if (SquadInp.value.length > 0) {
EntraInSquad.hidden = false;
EntraNellaSquadra.hidden = false;
} else {
EntraInSquad.hidden = true;
EntraNellaSquadra.hidden = true;
}
}

function ControlFormato() {
let regex = /^[a-zA-Z0-9]{3}$/; // Verifica se ci sono 3 lettere e 3 numeri senza spazi o caratteri speciali
if (regex.test(SquadInp.value)) {
//
window.alert(':)')
} else {
window.alert('Formato non valido');
}
Expand Down

0 comments on commit 9bed3ec

Please sign in to comment.