Skip to content

Commit e940693

Browse files
authored
Update index.html
1 parent fc054da commit e940693

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

index.html

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3095,24 +3095,26 @@ <h3 itemprop="eduQuestionType" style="margin:7px">Area of a Circle Segment</h3>
30953095
autoFilledField = "segment-height";
30963096
}
30973097

3098-
// Validity checks
3099-
if (h > r || l < 2 * h || r < h) {
3100-
output.innerText = 'Invalid input: must satisfy h ≤ r, l ≥ 2h, r ≥ h.';
3101-
return;
3102-
}
3103-
3098+
// Validity checks
3099+
if (h > r || l < 2 * h || r < h) {
3100+
document.getElementById('segment-area').innerText =
3101+
'Invalid input: must satisfy h ≤ r, l ≥ 2h, r ≥ h.';
3102+
// no return here — keep listening for further input
3103+
} else {
31043104
// Compute angle and area
31053105
let angle = Acos((r - h) / r);
31063106
let area = angle * r ** 2 - (r - h) * (l / 2);
31073107

31083108
// Output with semicircle reminders
31093109
if (h === r || h === l / 2 || l === 2 * r) {
3110-
output.innerText = `Semicircle area: ${area.toFixed(5)} square units`;
3110+
document.getElementById('segment-area').innerText =
3111+
`Semicircle area: ${area.toFixed(5)} square units`;
31113112
} else {
3112-
output.innerText = `Area: ${area.toFixed(5)} square units`;
3113+
document.getElementById('segment-area').innerText =
3114+
`Area: ${area.toFixed(5)} square units`;
31133115
}
31143116
}
3115-
3117+
}
31163118
// Attach listeners to all inputs
31173119
document.getElementById('segment-height').addEventListener('input', segmentArea);
31183120
document.getElementById('parent-radius').addEventListener('input', segmentArea);

0 commit comments

Comments
 (0)