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

Saturday, September 28, 2024

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

 

Binary to Octal Converter

Binary to Octal Converter

Octal Result:

-

Note: Only binary numbers (0s and 1s) are accepted.

body { font-family: Arial, sans-serif; background-color: #f0f8ff; color: #333; margin: 0; padding: 20px; } .container { max-width: 600px; margin: 0 auto; padding: 20px; border-radius: 8px; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1); background-color: #fff; } h1 { text-align: center; color: #4CAF50; } .input-group { margin-bottom: 20px; } label { display: block; margin-bottom: 5px; font-weight: bold; } input[type="text"] { width: 100%; padding: 10px; border: 2px solid #4CAF50; border-radius: 4px; } button { width: 100%; padding: 10px; background-color: #4CAF50; color: white; border: none; border-radius: 4px; font-size: 16px; cursor: pointer; transition: background-color 0.3s; } button:hover { background-color: #45a049; } .result-group { margin-top: 20px; } h2 { color: #4CAF50; } .note { margin-top: 10px; font-style: italic; color: #666; } document.getElementById('convertButton').addEventListener('click', function() { const binaryInput = document.getElementById('binaryInput').value; const resultElement = document.getElementById('result'); // Validate binary input if (!/^[01]+$/.test(binaryInput)) { resultElement.textContent = "Invalid input! Please enter a valid binary number."; return; } // Convert binary to decimal const decimal = parseInt(binaryInput, 2); // Convert decimal to octal const octal = decimal.toString(8); // Display result resultElement.textContent = octal; });

No comments:

Post a Comment