# Easy Calculator

Page 1 of 1

## 5 Replies - 1489 Views - Last Post: 11 November 2012 - 06:00 AM

### #1 CoLorZz

Reputation: 0
• Posts: 5
• Joined: 09-November 12

# Easy Calculator

Posted 09 November 2012 - 03:18 PM

this is simple calculator that i made i am a new young programmer so please no bad commnts
```<html>
<body>
<form name="form1">
<input type="text" name="txtimput">
</form>
<map name="calc" id="calc">
<area shape="rect" coords="7, 78, 74, 136" onclick="document.form1.txtimput.value+='1'"  name="1" />
<area shape="rect" coords="75, 80, 146, 132" onclick="document.form1.txtimput.value+='2'" name="2"  />
<area shape="rect" coords="148, 81, 213, 135" onclick="document.form1.txtimput.value+='3'" name="3"  />
<area shape="rect" coords="214, 79, 305, 137" onclick="document.form1.txtimput.value+='+'" name="+"  />
<area shape="rect" coords="6, 135, 75, 189" onclick="document.form1.txtimput.value+='4'" name="4"  />
<area shape="rect" coords="75, 138, 145, 189" onclick="document.form1.txtimput.value+='5'" name="5"  />
<area shape="rect" coords="146, 135, 212, 189" onclick="document.form1.txtimput.value+='6'" name="6"  />
<area shape="rect" coords="212, 135, 305, 188" onclick="document.form1.txtimput.value+='-'" name="-"  />
<area shape="rect" coords="6, 190, 73, 249" onclick="document.form1.txtimput.value+='7'"  name="7" />
<area shape="rect" coords="76, 190, 144, 248" onclick="document.form1.txtimput.value+='8'" name="8"  />
<area shape="rect" coords="145, 189, 213, 249" onclick="document.form1.txtimput.value+='9'" name="9"  />
<area shape="rect" coords="75, 250, 146, 317" onclick="document.form1.txtimput.value+='0'" name="0"  />
<area shape="rect" coords="213, 190, 307, 248" onclick="document.form1.txtimput.value+='*'" name="*"  />
<area shape="rect" coords="7, 250, 74, 315" onclick="document.form1.txtimput.value=''" name="C"  />
<area shape="rect" coords="147, 249, 213, 317" onclick="document.form1.txtimput.value+='.'" name="."  />
<area shape="rect" coords="214, 250, 306, 315" onclick="document.form1.txtimput.value=eval(form1.txtimput.value)"   name="=" />
<area shape="rect" coords="8, 11, 307, 75" href="#" name="imput"  />

</map>
<img src="calc.png" usemap="#calc">

</body>
</html>

```

Is This A Good Question/Topic? 0

## Replies To: Easy Calculator

### #2 CoLorZz

Reputation: 0
• Posts: 5
• Joined: 09-November 12

## Re: Easy Calculator

Posted 09 November 2012 - 03:51 PM

ow ok im sorry i just couldent redo my forum post like i dont now how lol sorry and i meant javascript i was trying to attach the pic

### #3 Atli

Reputation: 4240
• Posts: 7,216
• Joined: 08-June 10

## Re: Easy Calculator

Posted 09 November 2012 - 03:55 PM

OK. No problem

What is it, though, that you want our help with? Is there a specific question you want to ask, or a specific problem you want help with?

By the way, your HTML is missing the Doctype Declaration. This is required for all HTML pages. It tells the browser what type of HTML it's dealing with. The simplest doctype is the HTML5 doctype, which looks like:
```<!DOCTYPE HTML>

```

That should be the very first line of all HTML5 documents. No exceptions!

### #4 CoLorZz

Reputation: 0
• Posts: 5
• Joined: 09-November 12

## Re: Easy Calculator

Posted 09 November 2012 - 04:03 PM

ok idk im in gr10 and i started a programming class i just wanted to become a good member on this site so i thaught i should just post some random source

### #5 Atli

Reputation: 4240
• Posts: 7,216
• Joined: 08-June 10

## Re: Easy Calculator

Posted 09 November 2012 - 04:56 PM

I see. These forums are meant for programming help topics; where people can ask us to help them solve problems or answer programming related questions. If you just want to share some code snippets, we have a section for that. We also have a Tutorials section, if you want to write more detailed articles about a programming topic.

Know that Tutorials and Snippets are reviewed by the moderators before they are published, to make sure they are factually correct and well written. - For the record, the snippet you posted would probably not be approved. Writing the entire Javascript code inside the HTML "onclick" tags is sort of outdated and poorly set up. It's the sort of thing that was done ten years ago. You want to try and put your Javascript code inside <script> tags, or, preferably, in external Javascript files.

Just as an example, I wrote a simple Javascript calculator in a more "modern" way, to demonstrate the differences. This is more what you should be aiming for. Don't worry if some of this is beyond what you've learned so far. Stick with it and you'll get there in no time />

Spoiler

### #6 CoLorZz

Reputation: 0
• Posts: 5
• Joined: 09-November 12

## Re: Easy Calculator

Posted 11 November 2012 - 06:00 AM

im sowry and ill do my best to make it modern