View Full Version : Currency Calculator PROBLEM

06-10-2010, 01:19 AM
Hey I've been working on my Spanish Clubs' website over the summer and I need some help when making this converter. I want to make it so when someone chooses a different country, it will change the answeres and do the equation in the text boxes and also if they change the numbers manually they will also do the equation.

I've tried it out and it's making me go mad. PLEASE HELP!

Here is the javascript code I made:

function calculatecountry()
var country = calculate.countrys.options[calculate.countrys.selectedIndex].text;

if (countrys=="--Country--")
var usd1 = 0;
var other1 = 0;
if (countrys=="Argentina")
var usd1 = 0.2553;
var other1 = 1;
if (countrys=="Bolivia")
var usd1 = 0.14245;
var other1 = 1;
if (countrys=="Chile")
var usd1 = 0.0018;
var other1 = 1;

var c1 = calculate.other.value;
var c2 = calculate.usd.value;

var ans1 = c1 * other1;
var ans2 = c2 * usd1;

calculate.usd.value = ans1;
calculate.other.value = ans2;

Here is the form code:


<script type="text/javascript" src="js_money_calc.js"></script>


<form name="calculate">
<select name="countrys" onChange="calculatecountry()">
<option selected>--Country--</option>
<input type="text" name="usd" onKeyUp="calculatecountry()" /> = <input type="text" name="other" onKeyUp="calculatecountry()" /></p>



06-10-2010, 05:21 AM
If anyone knows a solution, I'd greatly appreciate it.

06-10-2010, 09:49 PM
anything at all will help I'd like some feedback, I've been waiting for like 24 hours.