Question

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.

Was it helpful?

Solution

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

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top