1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
777dan777 [17]
2 years ago
5

Create a simple JavaScript calculator.

Computers and Technology
1 answer:
Gre4nikov [31]2 years ago
3 0

Answer: edit out anything you dont need

<!DOCTYPE html>  

<html lang = "en">  

<head>  

<title> JavaScript Calculator </title>  

 

<style>  

h1 {  

   text-align: center;  

   padding: 23px;  

   background-color: skyblue;  

   color: white;  

   }  

 

#clear{  

width: 270px;  

border: 3px solid gray;  

   border-radius: 3px;  

   padding: 20px;  

   background-color: red;  

}  

 

.formstyle  

{  

width: 300px;  

height: 530px;  

margin: auto;  

border: 3px solid skyblue;  

border-radius: 5px;  

padding: 20px;  

}  

 

 

 

input  

{  

width: 20px;  

background-color: green;  

color: white;  

border: 3px solid gray;  

   border-radius: 5px;  

   padding: 26px;  

   margin: 5px;  

   font-size: 15px;  

}  

 

 

#calc{  

width: 250px;  

border: 5px solid black;  

   border-radius: 3px;  

   padding: 20px;  

   margin: auto;  

}  

 

</style>  

 

</head>  

<body>  

<h1> Calculator Program in JavaScript </h1>  

<div class= "formstyle">  

<form name = "form1">  

     

   <!-- This input box shows the button pressed by the user in calculator. -->  

 <input id = "calc" type ="text" name = "answer"> <br> <br>  

 <!-- Display the calculator button on the screen. -->  

 <!-- onclick() function display the number prsses by the user. -->  

 <input type = "button" value = "1" onclick = "form1.answer.value += '1' ">  

 <input type = "button" value = "2" onclick = "form1.answer.value += '2' ">  

 <input type = "button" value = "3" onclick = "form1.answer.value += '3' ">  

  <input type = "button" value = "+" onclick = "form1.answer.value += '+' ">  

 <br> <br>  

   

 <input type = "button" value = "4" onclick = "form1.answer.value += '4' ">  

 <input type = "button" value = "5" onclick = "form1.answer.value += '5' ">  

 <input type = "button" value = "6" onclick = "form1.answer.value += '6' ">  

 <input type = "button" value = "-" onclick = "form1.answer.value += '-' ">  

 <br> <br>  

   

 <input type = "button" value = "7" onclick = "form1.answer.value += '7' ">  

 <input type = "button" value = "8" onclick = "form1.answer.value += '8' ">  

 <input type = "button" value = "9" onclick = "form1.answer.value += '9' ">  

 <input type = "button" value = "*" onclick = "form1.answer.value += '*' ">  

 <br> <br>  

   

   

 <input type = "button" value = "/" onclick = "form1.answer.value += '/' ">  

 <input type = "button" value = "0" onclick = "form1.answer.value += '0' ">  

   <input type = "button" value = "." onclick = "form1.answer.value += '.' ">  

   <!-- When we click on the '=' button, the onclick() shows the sum results on the calculator screen. -->  

 <input type = "button" value = "=" onclick = "form1.answer.value = eval(form1.answer.value) ">  

 <br>  

 <!-- Display the Cancel button and erase all data entered by the user. -->  

 <input type = "button" value = "Clear All" onclick = "form1.answer.value = ' ' " id= "clear" >  

 <br>  

   

</form>  

</div>  

</body>  

</html>  

Explanation:

You might be interested in
What's the main idea??
tatyana61 [14]
My computer wont let me download this pdf

7 0
3 years ago
_______ software helps run the computer and coordinates instructions between other software and the hardware devices. select one
Mila [183]
'SYSTEM' <span> software helps run the computer and coordinates instructions between other software and the hardware devices.</span>
5 0
3 years ago
Which app is used to synchronize data among iOS devices and Windows desktops?
docker41 [41]
ICloud because it links your old device to the new one
4 0
3 years ago
Read 2 more answers
The most common schedule for tape-based backup is a _____ backup, either incremental or differential, with a weekly off-site ful
sergejj [24]

The most common schedule for tape-based backup is called the daily on-site backup.

<h3>What is daily backup?</h3>

The daily backup is known to be a kind of backs up of only files that were were said to be modified that day.

A full backup is known to be a full and complete backup of the whole system, such as all applications, operating systems components, etc.

Learn more about  backup from

brainly.com/question/86807

8 0
2 years ago
The valence electron configurations of several atoms are shown. how many bonds can each atom make without hybridization? 2s^2 2p
Pie
Answer: This element needs 3 electrons to complete its octet state

Why?:
since the electrons in 2s2 are already paired they cannot form a bond pair with electrons from other elements without hybridisation however the 3 electrons in 2p3 are unpaired so can form bond pairs with electrons from other elements without hybridisation.

Hope this helps!
3 0
3 years ago
Other questions:
  • ​A(n) ____ will hold an online auction buyer’s payment until he or she is satisfied that the item bought matches the seller’s de
    13·1 answer
  • William found out that someone used his report on American culture without his permission. What is William a victim of? A. plagi
    7·2 answers
  • The color pattern in which marine organisms are light on the bottom and dark on the top of their bodies camouflaging them agains
    11·1 answer
  • Write a computer program that computes the duration of a projectile’s flight and its height above the ground when it reaches the
    11·1 answer
  • On the classic gameshow The Price Is Right, contestants must guess the price of an object (guesses are distinct). The winner is
    5·1 answer
  • What is a function of Agile software development?<br>​
    7·1 answer
  • PLZ HELP ASAP
    13·1 answer
  • Define a function below, filter_out_strs, which takes a single argument of type list. Complete the function so that it returns a
    10·1 answer
  • What is the basic body structure of html.
    13·2 answers
  • A company is looking for an employee to help organize customer information for the sales team. Which computer field includes thi
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!