0% found this document useful (0 votes)
4 views1 page

Javascript Microproject

This document outlines a micro project for creating a simple calculator using HTML and JavaScript, capable of performing basic arithmetic operations. It aims to teach fundamental JavaScript programming and interaction with HTML elements. The provided sample code demonstrates the implementation of an addition function within the calculator application.

Uploaded by

sakshikhot0312
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views1 page

Javascript Microproject

This document outlines a micro project for creating a simple calculator using HTML and JavaScript, capable of performing basic arithmetic operations. It aims to teach fundamental JavaScript programming and interaction with HTML elements. The provided sample code demonstrates the implementation of an addition function within the calculator application.

Uploaded by

sakshikhot0312
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

JavaScript Micro Project: Simple Calculator

This micro project demonstrates a simple calculator built using HTML and JavaScript. The
calculator can perform basic operations like addition, subtraction, multiplication, and division.

Objectives:
1 Understand basic JavaScript programming.
2 Learn how to interact with HTML elements using JavaScript.
3 Create a simple calculator application.

Tools Required:
1 HTML
2 JavaScript
3 Web Browser (Chrome, Edge, etc.)

Sample Code:
<!DOCTYPE html>
<html>
<head>
<title>Simple Calculator</title>
<script>
function add(){
var a = parseFloat([Link]("num1").value);
var b = parseFloat([Link]("num2").value);
[Link]("result").innerHTML = "Result: " + (a + b);
}
</script>
</head>

<body>
<h2>Simple Calculator</h2>

Number 1: <input type="text" id="num1"><br><br>


Number 2: <input type="text" id="num2"><br><br>

<button onclick="add()">Add</button>

<p id="result"></p>

</body>
</html>

Conclusion:
This project shows how JavaScript can be used to perform calculations and interact with user inputs
in a web page. It is a basic example for beginners learning JavaScript.

You might also like