';
html += '| 每公里油耗 | ' + (oil/km*1000).toFixed(1) + ' mL/km |
';
html += '| 每公里成本 | ¥ ' + perKm.toFixed(2) + ' 元/km |
';
html += '| 总油费 | ¥ ' + cost.toFixed(2) + ' |
';
html += '| 百公里油费 | ¥ ' + (p100 * price).toFixed(2) + ' |
';
html += '
';
resultContent.innerHTML = html;
resultMeta.textContent = p100.toFixed(2) + ' L/100km';
resultArea.classList.add('show');
});
document.getElementById('btn-clear').addEventListener('click', function() { form.reset(); clearError(); clearResult(); });
})();