function calculateArea() {
const length = parseFloat(document.getElementById
('length').value);
const width = parseFloat(document.getElementById
('width').value);
const cutArea = parseFloat(document
.getElementById('cutArea').value);
if (isNaN(length) || isNaN(width) || isNaN
(cutArea)) {
document.getElementById('result').innerText =
"请输入有效的数字!";
const totalArea = length * width;
const remainingArea = totalArea - cutArea;
document.getElementById('result').innerText =
`剩余面积为:${remainingArea.toFixed(2)}
平方单位`;