Results 1 to 2 of 2
  1. #1
    techy is offline Member
    Join Date
    May 2013
    Posts
    1
    Rep Power
    0

    Default [NEED HELP]coding a simple calculator

    Hey guys,

    I'm new to Javascript and I'm trying to make a calculator without using the "eval" function. I am using jsbin.com to write my code and want to use the HTML and JavaScript partition, I got everything written in the HTML partition at the moment but i would like to have the JavaScript and the HTML seperated.Another problem is the "=" button, I have no idea how i can get the operation to work without eval, here is my code :

    <FORM NAME="Calculator">
    <TABLE BORDER=2>
    <tr>
    <td>
    <input type = "text" Name = "Input" size ="15">
    </br>
    </td>
    </tr>

    <tr>
    <td>
    <input type = "button" Name =
    "seven" Value = "7" OnCLick = "Calculator.Input.value += '7'">

    <input type = "button" Name =
    "eight" Value = "8" OnCLick = "Calculator.Input.value += '8'">

    <input type = "button" Name =
    "nine" Value = "9"OnCLick = "Calculator.Input.value += '9'">

    <input type = "button" Name =
    "divide" Value = "/"OnCLick = "Calculator.Input.value += '/'">

    </br>

    <input type = "button" Name =
    "four" Value = "4" OnCLick = "Calculator.Input.value += '4'" >

    <input type = "button" Name =
    "five" Value = "5" OnCLick = "Calculator.Input.value += '5'" >

    <input type = "button" Name =
    "six" Value = "6" OnCLick = "Calculator.Input.value += '6'" >

    <input type = "button" Name =
    "multiplication" Value = "*" OnCLick = "Calculator.Input.value += '*'" >

    </br>

    <input type = "button" Name =
    "one" Value = "1" OnCLick = "Calculator.Input.value += '1'" >

    <input type = "button" Name =
    "two" Value = "2" OnCLick = "Calculator.Input.value += '2'" >

    <input type = "button" Name =
    "nine" Value = "3" OnCLick = "Calculator.Input.value += '3'" >

    <input type = "button" Name =
    "minus" Value = "-" OnCLick = "Calculator.Input.value += '-'" >


    </br>

    <input type = "button" Name =
    "zero" Value = "0" OnCLick = "Calculator.Input.value += '0'" >

    <input type = "button" Name = "clear" Value = "c" OnCLick = "Calculator.Input.value = ' ' ">

    <input type = "button" Name =
    "equal" Value = "=">

    <input type = "button" Name =
    "plus" Value = "+" OnCLick = "Calculator.Input.value += '+'" >

    </td>
    </tr>

    Thanks in advance

  2. #2
    PhHein's Avatar
    PhHein is offline Senior Member
    Join Date
    Apr 2009
    Location
    Germany
    Posts
    1,430
    Rep Power
    6

    Default Re: [NEED HELP]coding a simple calculator

    What about finding yourself a Javascript forum? This is a Java forum.
    Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
    The Ubiquitous Newbie Tips

Similar Threads

  1. Rate my app : Simple Calculator
    By Akar-Slemany in forum New To Java
    Replies: 4
    Last Post: 03-22-2013, 11:16 PM
  2. Simple calculator
    By itaiyz97 in forum New To Java
    Replies: 2
    Last Post: 09-24-2012, 05:21 PM
  3. Simple Calculator
    By marksey07 in forum New To Java
    Replies: 12
    Last Post: 01-09-2011, 06:30 AM
  4. creating a simple calculator
    By hobo in forum New To Java
    Replies: 4
    Last Post: 11-09-2009, 03:09 AM
  5. Help with really simple coding
    By tigertomas in forum New To Java
    Replies: 10
    Last Post: 01-24-2009, 04:47 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •