...

View Full Version : Currency Calculator PROBLEM



runestation
06-10-2010, 12: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;

//===============================COUNTRIES====================================
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;
}
//================================EQUATIONS=====================================

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:



<html><head><title></title>

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

</head><body>

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

</body></html>



Thanks.

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

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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum