Petya petrov
Petya petrov

Reputation: 2223

building calculator with complex behavior (javascript)

i need to build a calculator. The input is a textarea and the behavior is a little complex, it should be like on this video http://www.youtube.com/watch?v=tR5tyhPmawE , 0:00 - 0:30 part. But im a little confuse where to start, im building basic interface and input. Can you point me in the right directions, im just dont know how to manage multilines wise. Thank you.

Upvotes: 0

Views: 1027

Answers (2)

symcbean
symcbean

Reputation: 48387

Javascript already provides the functionality via eval. But you need to strip out any non-numeric chars and perform a currency type rounding on the operations.

If you want interactive operations, then look for a newline char with the onkeyup handler.

Upvotes: 1

RobertPitt
RobertPitt

Reputation: 57268

Here's something that will help you get started.

I quickly wrapped up a sample demo @ http://jsfiddle.net/3tCep/

you can view the source here: https://github.com/davidnorth/JsReckoner

Upvotes: 1

Related Questions