0 svar
44 visningar
Shali_Mehr Online 271
Postad: 6 apr 18:44

hur kan jag använda firebase i min js så att det kan fungera medan användare gör inloggningen ?

<script>





		document.addEventListener('DOMContentLoaded', function() {
		    var input = document.getElementById('register');
		    var button = document.getElementById('submit');

		    // Event listener for input change
		    input.addEventListener('input', function() {
		        if (input.value === "") {
		            input.style.border = "2px solid red";
		            input.style.backgroundColor = "black";
		            input.style.color = "white";
		        } else {
		            input.style.border = ""; // Reset border style
		        }


		    });
		    input.addEventListener('mouseout', function() {
			    if (input.value === "") {
			        input.style.border = ""; // Reset border style
			        input.style.backgroundColor = "white";
			        input.style.color = "black";
			    }
			});


			button.addEventListener('click', function(event) {
		        event.preventDefault();
		        // Get form value
		        var input = document.getElementById('register');

		        if (input.value === "") {
		        	alert('Please fill in both username and password.');
		        }else{

		        	setTimeout(function() {
		        		// body...
		        		window.location.href = 'cars.html';
		        	},1000);
		        }
		    });
		});	
	</script>
Svara
Close