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

Wednesday, September 25, 2024

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

 

HEX to Binary Converter

HEX to Binary Converter

Binary Output:

body { background-color: #f8f9fa; } .card { background-color: #ffffff; border-radius: 15px; } .btn { transition: background-color 0.3s ease; } .btn:hover { background-color: #17a2b8; } #binaryOutput { font-family: monospace; font-size: 1.2em; color: #343a40; overflow-wrap: break-word; } document.getElementById('convertBtn').addEventListener('click', function() { const hexInput = document.getElementById('hexInput').value.trim(); const binaryOutput = document.getElementById('binaryOutput'); // Validate HEX input if (!/^([0-9A-Fa-f]{1,6})$/.test(hexInput)) { binaryOutput.textContent = "Please enter a valid HEX value (1 to 6 characters)."; binaryOutput.style.color = 'red'; return; } // Convert HEX to Binary const decimalValue = parseInt(hexInput, 16); const binaryValue = decimalValue.toString(2); binaryOutput.textContent = binaryValue; binaryOutput.style.color = 'green'; });

No comments:

Post a Comment