<button>CLICK ME!</button> <script> var pass ; document.querySelector("button").addEventListener("click", function() { pass = prompt("Введите пароль", "") ; }) ; </script>