Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Feb 2010
    Posts
    30
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Question Currency Calculator PROBLEM

    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:

    Code:
    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:

    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.
    Last edited by runestation; 06-10-2010 at 03:02 PM.

  • #2
    New Coder
    Join Date
    Feb 2010
    Posts
    30
    Thanks
    4
    Thanked 0 Times in 0 Posts
    If anyone knows a solution, I'd greatly appreciate it.

  • #3
    New Coder
    Join Date
    Feb 2010
    Posts
    30
    Thanks
    4
    Thanked 0 Times in 0 Posts
    anything at all will help I'd like some feedback, I've been waiting for like 24 hours.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •