document.getElementById('smart-form').addEventListener('submit', function(event) { event.preventDefault(); var complementoUrl = document.getElementById('smart-input').value; var numero = parseInt(complementoUrl); // Converte o valor de entrada para um número inteiro var smartUrl; // Verifica se o complementoUrl é um número válido if (isNaN(numero)) { alert('Por favor, insira um número válido.'); return; } // Verifica o intervalo do número e define a URL base apropriada if (numero >= 1 && numero <= 400) { smartUrl = 'https://ossmartsystem.com/smart'; } else if (numero >= 401 && numero <= 910) { smartUrl = 'https://smartsystem.app.br/smart'; } else if (numero >= 911 && numero <= 1042) { smartUrl = 'https://smartsys.app.br/smart'; } else if (numero >= 1043) { smartUrl = 'https://smartacesso.com/smart'; } else { alert('Número fora do intervalo permitido'); return; // Sai da função se o número estiver fora do intervalo permitido } var url = smartUrl + complementoUrl; window.open(url, 'SMART System', 'width=1000,height=700'); window.close(); });