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

Monday, September 30, 2024

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

 

Octal to Hex Converter

Octal to Hexadecimal Converter

body { background-color: #f8f9fa; color: #343a40; } .card { background-color: #ffffff; border-radius: 8px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); } .result-text { font-weight: bold; font-size: 1.5em; color: #28a745; /* Green color for result */ } document.getElementById('convertButton').addEventListener('click', function() { const octalInput = document.getElementById('octalInput').value; const resultDiv = document.getElementById('result'); const hexOutput = document.getElementById('hexOutput'); // Validate octal input if (/^[0-7]+$/.test(octalInput)) { // Convert octal to decimal const decimalValue = parseInt(octalInput, 8); // Convert decimal to hexadecimal const hexValue = decimalValue.toString(16).toUpperCase(); hexOutput.textContent = hexValue; resultDiv.style.display = 'block'; } else { alert('Please enter a valid octal number.'); resultDiv.style.display = 'none'; } });

No comments:

Post a Comment