I did a project a few years ago and was
quite successful thanks to webdeveloper.com
forum:
[URL=”http://www.epourania.com/wallcalc/wallcalc20.html”]wall calculator
I’m now attempting a new project and using
the basic of this javascript code, however
I cannot seem to get it to pass variables
using the “… input type=”radio” …”.
I can get it to work with one radio, but
not with two.
[code=php]<html><head>
<title>generic calculator javascript</title>
<script type=”text/javascript” language=”JavaScript”>
<!–
function CalculateTotals()
{
f=document.calculator;
f.first_result.value = Number(f.first_number.value);
}
//–>
</script>
</head>
<BODY >
<form NAME=”calculator” method=”post” ACTION=””>
<TABLE>
<TR><TD>First Number</TD>
<TD><input type=”radio” NAME=”first_number” value=”1″
onclick=”CalculateTotals()”></TD></tr>
<tr><td>Second Number</td>
<td><input type=”radio” name=”first_number” value=”2″
onclick=”CalculateTotals()”></td></tr>
<TR><TD>First Result</td><td>
<input NAME=”first_result” size=”4″ >
</TD></TR>
</TABLE>
</form>
</body>
</html>
When I remove:
[code=php]<tr><td>Second Number</td>
<td><input type=”radio” name=”first_number” value=”2″
onclick=”CalculateTotals()”></td></tr>
it works fine.
The code I will be working on I developed in PHP:
[URL=”http://www.anothenservices.com/PHP/ranking/rank.php”]Currency Ranking Tool
I’m hoping to do it in Javascript.
It takes two arrays and “… shift — unshift …” into a final array.
I want to avoid using a submit button and would rather
use Javascript because it’s faster and more efficient.