'; html += ''; html += ''; html += ''; html += ''; html += '
本金¥ ' + P.toFixed(2) + '
年化' + (r*100).toFixed(2) + '%
年付息¥ ' + (P*r).toFixed(2) + '
'; resultContent.innerHTML = html; resultMeta.textContent = '总收益 ¥' + gain.toFixed(2); resultArea.classList.add('show'); }); document.getElementById('btn-clear').addEventListener('click', function() { form.reset(); clearError(); clearResult(); }); })();