Header Ads Widget

Responsive Advertisement

all Units Converter Tools

Units Converter

Units Converter

Converted Length:

0

body { font-family: Arial, sans-serif; background-color: #f9f9f9; margin: 0; padding: 0; } .container { max-width: 600px; margin: 0 auto; padding: 20px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); background-color: #ffffff; } h1 { text-align: center; color: #4CAF50; } .converter { display: flex; margin-bottom: 10px; align-items: center; } label { flex: 1; margin-right: 10px; } input[type="number"] { flex: 2; padding: 10px; margin-right: 10px; border: 1px solid #ccc; border-radius: 4px; } select { flex: 1; padding: 10px; border: 1px solid #ccc; border-radius: 4px; } .result { margin-top: 20px; padding: 10px; background-color: #f2f2f2; border-radius: 4px; } .result p { margin: 0; color: #333; } #outputLength { font-weight: bold; color: #333; } document.getElementById('inputLength').addEventListener('input', convertLength); document.getElementById('unitType').addEventListener('change', convertLength); function convertLength() { const inputLength = parseFloat(document.getElementById('inputLength').value); const selectedUnit = document.getElementById('unitType').value; if (isNaN(inputLength)) { document.getElementById('outputLength').textContent = '0'; return; } const meter = Qty(inputLength, selectedUnit); const convertedLengthInMeters = meter.to('m'); document.getElementById('outputLength').textContent = convertedLengthInMeters.toFixed(2); }

Post a Comment

0 Comments