Forum:Javascript calculator

Yet another website that hosted a popular calculator thingy went offline, so I'm thinking about making a more reliable one right here. My last JS project didn't go too well without help, so I'll probably need some on this one as well :)

What I intend to do is something that looks like the pic on the right. There will be several fields (Value 1-x boxes) that accept numbers from users. When users click on Button, the javascript will use specified values in several formulas to display information in the Output box.

Is something like this possible on wikia? Has anyone tried it already, that I could see as an example?

As I understand it, I'll need to create a Form onsubmit Event.

-- 10:14, October 25, 2011 (UTC)


 * It's very much possible. See here for a similar tool. — Sovq 10:21, October 25, 2011 (UTC)


 * I felt like playing around and created something like this - http://jsfiddle.net/YDNqV/. It currently only sums up the values in the fields, but I imagine any math can be done on the values. Of course the styling can be easily modified with CSS afterwards. — Sovq 11:18, October 25, 2011 (UTC)


 * Just what I needed :) Thanks, now it's much easier to figure out. -- 11:48, October 25, 2011 (UTC)


 * Yessss! It's alive! I'll post an update later :) -- 14:38, October 25, 2011 (UTC)

(Update)

I managed to write this calc (javascript and html). It seems to be working correctly, as far as my algorithm goes.

Are there any syntax issues, or did I miss anything? I used the JSLint thingy in jsfiddle, and it doesn't show any errors.

I also used the Inconsolata font for some of the text, since jsfiddle had it and it looked nice. Can everyone see it, or just me? I assumed it works for everyone because I don't have it on my PC. -- 22:13, November 3, 2011 (UTC)


 * It does display some results when clicking the "Calculate" button, so the script is definitely working. Don't ask me if all the math is done right though - I have no clue what it should be. You might want to check if other scripts on your wiki are not in conflict with this one. The previously linked stat calculator on Dead Frontier Wiki broke the new editor's Visual Mode for some time. — Sovq 07:07, November 4, 2011 (UTC)