You are not logged in.
Pages: 1
hello im making a homepage and id like a calculator on it made in javascript the thing is im not really any good in coding javascript
so i was wondering if anyone could possibly help me
this is a mockup of what i was thinking of :
and if its empty or someone enters a letter instead of a sign it gives a errors message but otherwise it prints the number underneath
im not asking anyone to make this for me but if someone can give me some help in how to make it i would be very grateful (ofc is someone WANTS to make it i wont stop them)
thanks in advance INCSlayer
dovie andi se tovya sagain
Offline
JavaScript has function to check if they are a number, for instance IsNaN() to check if it is not a number. [Please have a look at a js reference for function names).
The should be a number() function, too, to convert a string to a number (again, see a reference for exact names), which you can use initially for conversation. Afterwards it's a simple DOM operation to replace the text of some field. OK, simple is a lie, but there are plenty of tutorials on that. That's something like document.getElementById('textfield').data = result; , but please refer to a tutorial for the syntax.
Offline
Rather than recreate the wheel, theres a javascript function eval() that evaluates equations. If something doesn't work, you can write your own function. If you need help I don't mind being pm'd, I've got a bunch of free time lately.
Offline
Pages: 1