Forum Moderators: open
Enter Number [text box]
multiply by: [text box]
[calculate Button]
Answer is: [answer displayed here]!
Hope you get the general idea!
Is their a method/formula for doing these sorts of sums?
If not what programs should i be using or learning?
I wrote a visual basic application a few years ago that does all the calculations that would be required in my field. I havent touched VB in years so i dont even know if that could be converted to go on the site?
Any help or advice greatly appreciated!
Thanks
Plenty of examples on the web; try:
[google.com...]
If you have no experience of JavaScript it may be best to get into the basics of JavaScript first, in particular how you get and set form field values...
[edited by: dmorison at 6:04 pm (utc) on Dec. 23, 2003]
Just do a search for -> basic math scripts
and you will get plenty of information on implementing math functionality into your web site.
You're interested in some scripting. Server-side scripting requires support by the hosting server. This could be PHP, ASP, Perl, or any number of alternatives. Your visitors would enter the numbers & click the button which would post the figures back to the server. The server would serve up another page with the results.
An alternative is client-side scripting. I think this is what most online mortgage calculators I've seen are doing.
The browser loads a small script & runs it right there. This can be done in VBScript or Java ... probably some alternatives there too. But now that the browser is doing the work, you get into issues of which browsers support which constructs of which languages. Most modern browsers support Java, but there are differences in how they treat various aspects of it.
I think there's a Java forum here ... and you'd get more help there I suspect.
I have no experience in java at all! but i guess you have got to start somewhere.
I wrote a simple JS calculator (my first and only JS program) by looking at a couple of calculators and shamelessly stealing and modifying. Most programming languages are fairly similar, and a simple program in most languages is fairly understandable even by someone who has not used that language.
I used the w3schools tutorials to help me, found them moderately useful. Also asked many questions here when I got stuck!
A full JS book would have been overkill for my needs, but might be the way to go if you plan on doing more than that calculator.
<added>We now have a Javascript Forum [webmasterworld.com] where you can ask for advice.</added>
I think a book would probably be a bit of an overkill for me to. The calculations i want to do on the website is quite basic stuff. For example convert Litres to Gallons, PSI to BAR.
If i could find a basic script for this i think it would be easy to modify for other similar conversions.
I was thinking of making the program i made available for free download, but if i can get the conversions to run online it may help in keeping visitors coming back to my site.
I started to learn JavaScript in www.quirksmode.org, so I would recommend to go there to begin with the basics of the language, very good resource i think.
Click on the "Interactive Converters" page and then view source to get some ideas:
www.economatics.co.uk/industrial/conversiontables/
Good Luck