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 do character format's do for your documents message
MrMuchimi

depends you could use .doc .pdf whatever you would prefer if you made a document and named it mybirthdaylist if you would put it in .doc or .pdf

3 0
3 years ago
What is a name used to identify a specific location and value in memory?a. Variable b. Operator c. Control structure d. Object
Ipatiy [6.2K]

Answer:

(a) Variable

Explanation:

In the programming world, a variable is used to store data that can be referenced and modified in a computer program. It typically refers to the label for the location (in memory) of a particular data used in programs. For example;

var b = 12.

This implies that the value 12 is stored in a location in memory that is labeled as b. Anytime the value 12 is needed either for retrieval or modification purposes, it can be referenced by simply calling the variable b.

7 0
3 years ago
6. Which devices of computer is known processing devices? las &gt;​
Sholpan [36]

Central processing unit (CPU) Graphics processing unit (GPU) Motherboard. Network card

6 0
2 years ago
Read 2 more answers
How do you get points without answering questions i need the points for my math D:
maw [93]
You can't you need to answer questions I think
8 0
3 years ago
Read 2 more answers
Order the steps to describe how to attach a contact to a new email
kolbaska11 [484]

Answer:

confirm image correct

Explanation:

7 0
2 years ago
Other questions:
  • Write a C++ program that searches for anagrams in a dictionary. An anagram is a word obtained by scrambling the letters of some
    5·1 answer
  • What three components make up a film camera?
    14·2 answers
  • Accessing calendars, contact information, email, files and folders, instant messaging, presentations, and task lists over the in
    8·2 answers
  • To extend the bottom border of a hyperlink across the complete width of a navigation list, change the ____ property of each hype
    9·1 answer
  • An administrator is writing into a database and received an error detailed in the exhibit. What two steps need to be taken to re
    11·1 answer
  • CHALLENGE ACTIVITY 4.2.2: Basic while loop with user input. Write an expression that executes the loop while the user enters a n
    14·1 answer
  • Macro photographs are what type of photographs? A. Close-up B. Telephoto C. Abstract D. All of the above
    14·1 answer
  • HELP PLEASE!
    13·2 answers
  • How do I get the bot token for discord? (scripting etc)
    5·1 answer
  • Why did the boy run from the pillow...... wrong answers only
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!