View Single Post
Old 11-20-2008, 04:12 PM   #4 (permalink)
Capo64
Contributing Member
 
Join Date: 06-11-07
Posts: 238
iTrader: 0 / 0%
Latest Blog:
None

Capo64 is a jewel in the roughCapo64 is a jewel in the roughCapo64 is a jewel in the roughCapo64 is a jewel in the roughCapo64 is a jewel in the roughCapo64 is a jewel in the rough
You need JavaScript for this (or atleast that's the most sensible solution).

set up your form like this:

Code:
<form> Value 1: <input onchange="calc();" type="text" name="value1" id="value1" /> Value 2: <input onchange="calc();" type="text" name="value2" id="value2" /> etc. </form> <div id="equation"></div><input type="button" value="Calculate" onclick="calc();" /> <div id="total"></div>
and the JavaScript would be:

Code:
<head> <script type="text/javascript"> calc() { document.getElementById('equation').innerHTML = document.getElementById('value1').text + ' x ' + document.getElementById('value2').text + ' - ' + document.getElementById('value3').text + ' = ' + (document.getElementById('value1').text * document.getElementById('value2').text - document.getElementById('value3').text); } </script> </head>
I hope that's enough for you to create your own version 'cause I don't feel like typing anymore lol
Capo64 is offline   Reply With Quote