All Rounder Tools Blogger-Best blog for blogger: Binary to Decimal converter Tool with colorful styling and all its features use any free library...

Wednesday, September 25, 2024

Binary to Decimal converter Tool with colorful styling and all its features use any free library...

 

Binary to Decimal Converter

Binary to Decimal Converter

body { font-family: 'Arial', sans-serif; background: linear-gradient(135deg, #f5f7fa, #c3cfe2); display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; } .container { background-color: #ffffff; border-radius: 10px; box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1); padding: 20px; text-align: center; width: 90%; max-width: 400px; } h1 { color: #333; } input { width: 100%; padding: 10px; margin: 10px 0; border: 2px solid #4CAF50; border-radius: 5px; font-size: 16px; } button { background-color: #4CAF50; color: white; padding: 10px 15px; border: none; border-radius: 5px; cursor: pointer; font-size: 16px; } button:hover { background-color: #45a049; } .result { margin-top: 20px; font-size: 20px; color: #4CAF50; } .error { margin-top: 20px; font-size: 20px; color: #ff0000; } document.getElementById('convertBtn').addEventListener('click', function() { const binaryInput = document.getElementById('binaryInput').value; const resultDisplay = document.getElementById('resultDisplay'); const errorDisplay = document.getElementById('errorDisplay'); // Clear previous results resultDisplay.innerHTML = ''; errorDisplay.innerHTML = ''; // Validate binary input if (!/^[01]+$/.test(binaryInput)) { errorDisplay.innerHTML = 'Please enter a valid binary number.'; return; } // Convert binary to decimal const decimalValue = parseInt(binaryInput, 2); resultDisplay.innerHTML = `Decimal Value: ${decimalValue}`; });

No comments:

Post a Comment

Supreme Court Reduces Mandatory Three-Year Legal Practice to One Year for Entry-Level Judicial Examination

The Supreme Court of India has recently brought a significant change in the eligibility requirements for entry-level judicial service examin...