<!DOCTYPE html>
<html> <head> <title>Decimal to Text Converter</title> <style> body { font-family: Arial, sans-serif; background-color: #f2f2f2; padding: 20px; } .container { max-width: 800px; margin: 0 auto; } h1 { color: #333; margin-bottom: 20px; } .input-field { width: 100%; padding: 10px; border: 2px solid #ccc; border-radius: 4px; box-sizing: border-box; } .convert-button { margin-top: 10px; padding: 10px 20px; font-size: 16px; font-weight: bold; color: #fff; background-color: #4CAF50; border: none; border-radius: 4px; cursor: pointer; } .convert-button:hover { background-color: #45a049; } .result { margin-top: 20px; border: 2px solid #ccc; border-radius: 4px; padding: 10px; background-color: #fff; } .error { color: #ff0000; } </style> </head> <body> <div class="container"> <h1>Decimal to Text Converter</h1> <input id="inputDecimal" class="input-field" type="text" placeholder="Enter decimal representation"> <button onclick="convertToText()" class="convert-button">Convert</button> <div id="result" class="result"></div> </div> <script> function convertToText() { var inputDecimal = document.getElementById("inputDecimal").value; var decimalArray = inputDecimal.trim().split(" "); var text = ""; for (var i = 0; i < decimalArray.length; i++) { var decimalCode = parseInt(decimalArray[i], 10); text += String.fromCharCode(decimalCode); } document.getElementById("result").textContent = "Text: " + text; } </script> </body> </html>
Comments
Post a Comment
sunil191280@gmail.com