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

Saturday, September 28, 2024

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

 

Octal to Binary Converter

Octal to Binary Converter

Binary Value:

0

body { font-family: Arial, sans-serif; background: linear-gradient(to right, #4facfe, #00f2fe); display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; } .container { background: white; border-radius: 15px; padding: 20px; box-shadow: 0 0 20px rgba(0, 0, 0, 0.1); text-align: center; max-width: 400px; width: 90%; } h1 { color: #333; } input[type="text"] { width: 100%; padding: 10px; border: 2px solid #00f2fe; border-radius: 5px; margin-bottom: 10px; font-size: 16px; } button { background-color: #4facfe; color: white; border: none; padding: 10px; border-radius: 5px; cursor: pointer; font-size: 16px; transition: background-color 0.3s; } button:hover { background-color: #00f2fe; } .result { margin-top: 20px; } h2 { color: #333; } #binaryOutput { font-size: 24px; font-weight: bold; color: #4facfe; } document.getElementById("convertButton").addEventListener("click", function() { const octalInput = document.getElementById("octalInput").value; const binaryOutput = document.getElementById("binaryOutput"); // Validate input if (octalInput === "") { binaryOutput.textContent = "Please enter a valid number!"; return; } // Check if the input is a valid octal number if (!/^[0-7]+$/.test(octalInput)) { binaryOutput.textContent = "Please enter a valid octal number!"; return; } // Convert octal to decimal const decimalValue = parseInt(octalInput, 8); // Convert decimal to binary const binaryValue = decimalValue.toString(2); // Update output binaryOutput.textContent = binaryValue; });

No comments:

Post a Comment