Pages

Wednesday, 27 November 2024

Text to Decimal Converter Tool

Text to Decimal Converter

Text to Decimal Converter

Decimal Output:

body { background: linear-gradient(to right, #4facfe, #00f2fe); color: #fff; font-family: 'Arial', sans-serif; } .card { background-color: #ffffff; color: #000; border-radius: 10px; } textarea { font-size: 16px; color: #333; } .output-box { background: #f8f9fa; border: 2px dashed #17a2b8; padding: 10px; border-radius: 5px; word-wrap: break-word; } .btn-success { background-color: #28a745; border: none; transition: 0.3s; } .btn-success:hover { background-color: #218838; } h1, h4 { text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.2); } @media (max-width: 768px) { .card { padding: 1rem; } h1 { font-size: 24px; } } document.addEventListener('DOMContentLoaded', () => { const textInput = document.getElementById('textInput'); const convertBtn = document.getElementById('convertBtn'); const decimalOutput = document.getElementById('decimalOutput'); // Convert text to decimal convertBtn.addEventListener('click', () => { const text = textInput.value; if (!text) { decimalOutput.textContent = "Please enter text to convert!"; decimalOutput.style.color = "red"; return; } decimalOutput.style.color = "black"; const decimalValues = Array.from(text) .map(char => char.charCodeAt(0)) // Get Unicode value of each character .join(' '); decimalOutput.textContent = decimalValues; }); });