https://github.com/itzdiv/ttrl
reconfiguring skills
https://github.com/itzdiv/ttrl
Last synced: 9 months ago
JSON representation
reconfiguring skills
- Host: GitHub
- URL: https://github.com/itzdiv/ttrl
- Owner: itzdiv
- Created: 2025-05-30T13:50:53.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-05-30T13:57:14.000Z (about 1 year ago)
- Last Synced: 2025-07-08T14:42:52.115Z (11 months ago)
- Language: HTML
- Size: 1.95 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
๐ Question: Rectangle Area Calculator Web App
You are required to create a simple Rectangle Area Calculator using
HTML and JavaScript. The application should allow users to input
the length and breadth of a rectangle, and upon clicking a button,
it should calculate and display the area.
๐ Files Provided:
-
index.htmlโ The HTML structure of the application. -
script.jsโ A separate JavaScript file linked toindex.htmlto handle the functionality.
โ Your Task Is to:
๐น In index.html:
- Create a form-like layout that includes:
- A labeled input field for length (number input).
- A labeled input field for breadth (number input).
- A button labeled "Calculate Area".
- A
<div>element withid="result"where the calculated area will be displayed.
- Link the external JavaScript file
script.jsjust before the closing</body>tag.
๐น In script.js:
- Write JavaScript code to:
- Get the values entered for length and breadth.
- Calculate the area using the formula:
Area = length ร breadth - Update the text inside
<div id="result">to display the calculated area.
- Ensure the calculation is triggered only when the user clicks the "Calculate Area" button.
๐ก Additional Notes:
- Use DOM methods like
document.getElementById()orquerySelector()to access and update elements. - Validate inputs: If either field is empty, zero, or not a number, show an appropriate error message in the result div.
- Styling is optional but may be rewarded if time permits.
๐งช Example:
User enters:
- Length:
5 - Breadth:
4
On clicking "Calculate Area", the output should be:
Area of Rectangle: 20