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

Sunday, September 29, 2024

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

 

Octal to Decimal Converter

Octal to Decimal Converter

body { font-family: 'Arial', sans-serif; background-color: #f0f4f8; margin: 0; padding: 20px; } .container { max-width: 400px; margin: 0 auto; padding: 20px; border-radius: 10px; background-color: #ffffff; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); text-align: center; } h1 { color: #333; } input[type="text"] { width: 80%; padding: 10px; margin-bottom: 10px; border: 2px solid #4a90e2; border-radius: 5px; font-size: 16px; transition: border-color 0.3s; } input[type="text"]:focus { border-color: #007bff; outline: none; } button { padding: 10px 20px; background-color: #4a90e2; color: white; border: none; border-radius: 5px; font-size: 16px; cursor: pointer; transition: background-color 0.3s; } button:hover { background-color: #007bff; } .result { margin-top: 20px; padding: 10px; border: 1px solid #4a90e2; border-radius: 5px; font-size: 18px; color: #333; display: none; } document.getElementById("convertButton").addEventListener("click", function() { const octalInput = document.getElementById("octalInput").value; const resultContainer = document.getElementById("resultContainer"); // Validate input if (!/^[0-7]+$/.test(octalInput)) { resultContainer.textContent = "Please enter a valid octal number."; resultContainer.style.color = "red"; resultContainer.style.display = "block"; return; } // Convert octal to decimal const decimalValue = parseInt(octalInput, 8); // Display result resultContainer.textContent = `Decimal Value: ${decimalValue}`; resultContainer.style.color = "#4a90e2"; // Color for valid output resultContainer.style.display = "block"; });

No comments:

Post a Comment