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
Similarities between human and computer​
Zielflug [23.3K]

Answer: Both have a center for knowledge; motherboard and brain. Both have a way of translating messages to an action. Both have a way of creating and sending messages to different parts of the system.

5 0
3 years ago
Write a program to play an automated game of Rock, Paper, Scissors. Two players make one of three hand signals at the same time.
zhuklara [117]

Answer:https://www.chegg.com/homework-help/questions-and-answers/program-specifications-write-program-play-automated-game-rock-paper-scissors-two-players-m-q84530098

3 0
2 years ago
How would our lives be different without computers at home?
Yuri [45]

Answer:

It would be so difficult to spend a life without computers. We would not be aware of technology or what things are being discovered. We could get information by newspaper, television, radio or some other medium but on computers.

Explanation:

Thanks for the points have a good day <3

8 0
2 years ago
How many parts make up a web address? One To Three​
hoa [83]

Answer:

3

Explanation:

7 0
3 years ago
The medisoft menu bar contains ____ menus.
scoray [572]
The answer will be 9 I think, not sure
7 0
3 years ago
Other questions:
  • I WILL GIVE BRAINLIEST TO WHO ANSWERS FIRST AND CORRECTLY.
    5·1 answer
  • Web sites use _____ to track users while they are on the site.
    14·1 answer
  • The Earth's _______ is ductile overall, tending to flow very slowly and deform in a _______ manner.
    14·2 answers
  • A slideshow that accompanies an oral report is known as what?
    6·1 answer
  • Problem 3. Consider the following recurrence, defined for n a power of 4 (for the time of some algorithm): T(n) = 3 if n = 1 2T(
    5·1 answer
  • Dan works for an automobile company. He has designed a new model of a car based on an older version. Which technology can he use
    6·1 answer
  • A malicious user in your organization was able to use the Trinity Rescue Kit to change the password on a department manager's co
    7·1 answer
  • Because travel distance, cost of living, and other factors vary among the three regions, the annual cost of having a salesperson
    14·1 answer
  • How do you do 1.17.5, invert colors, on codehs?
    10·1 answer
  • Question in file i need this work done tonight
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!