title: Methods, Objects to create currency converter in javascript
body: <p>This is going to be a long one.  I have an assignment I have been working on and I have been having issues.  I have a ton of code and I am not quite sure how to get it to function properly if at all with what I am trying to do.  I will post the sections and maybe some of you can see that I am trying to keep this in JavaScript only and not jQuery or pHp or anything else, keep seeing that as responses.</p>
  
  <p>First part: html code</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  
  &lt;head&gt;
  &lt;title&gt;Currency Converter 2.0&lt;/title&gt;
  &lt;meta charset="utf-8"&gt;
  &lt;link rel="stylesheet" href="currency.css"&gt;
  &lt;script src="currency1.js"&gt;
  &lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;h1&gt;Currency Converter&lt;/h1&gt;
  &lt;p&gt;Enter Dollar Amount&lt;/p&gt;
  &lt;form&gt;
    &lt;input type="text" id="currencyTextInput" size="40" placeholder="For example 12.12"&gt;
    &lt;input type="submit" id="addButton" value="Enter"&gt;
  &lt;/form&gt;
  &lt;ul&gt;
    &lt;li id="money0"&gt;&lt;/li&gt;//these names are not final,
    &lt;li id="money1"&gt;&lt;/li&gt;//I know i will need to change them
    &lt;li id="money2"&gt;&lt;/li&gt;
    &lt;li id="money3"&gt;&lt;/li&gt;
    &lt;li id="money4"&gt;&lt;/li&gt;
  &lt;/ul&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>second part: .js file</p>
  
  <pre><code>window.onload = function () {
  var button = document.getElementById("addButton");
  button.onclick = handleButtonClick;
  }
  
  var exchangeRate = []; 
  //this will be later one in the code, but aiming to have data pushed in here from objects
  
  function handleButtonClick(e) {
  var textInput = document.getElementById("currencyTextInput");
  var moneyString = textInput.value;
  var parsedMoney = parseFloat(moneyString);
  var valid = !isNaN(parsedMoney);
  
  if (!valid) {
          alert("Please, enter a valid number");
  } else {
      //planning on using this part to list my results in a bullet list   
  }
  e.preventDefault();
  }
  </code></pre>
  
  <p>So with testing that part works with my html code, minus the else.
  the rest of my code with my methods.  this is where I am having issues.  I can do one method and have it work, but I have 5 that I am to get the info from.</p>
  
  <pre><code>function GetCurrency(name, cRate) {
  this.name = name;
  this.c_rate = c_rate;
  this.convert = function(usd) {
     cRate * currencyTextInput  //not sure if this will grab that info or not
  return //haven't the slightest idea where to send this data
  }
  }
  
  var e_u = {
  name: "European Euro",
  cRate: 0.77334,
  convert: function() {
     cRate * currencyTextInput
  return exchangeRate.push(exchangeRate())//not sure if this is possible or do I need
  }                                       //to assign an array slot for it
  };
  
  var u_k = {
  name: "British Pound Sterling",
  cRate: 0.66202,
  convert: function() {
     cRate * currencyTextInput
  return exchangeRate.push(exchangeRate())
  }
  };
  
  var india = {
  name: "Indian Rupee",
  cRate: 55.7155,
  convert: function() {
     cRate * currencyTextInput
  return exchangeRate.push(exchangeRate())
  }
  };
  
  var aus = {
  name: "Australian Dollar",
  cRate: 1.02931,
  convert: function() {
     cRate * currencyTextInput
  return exchangeRate.push(exchangeRate())
  }
  };
  
  var japan = {
  name: "Japanese Yen",
  cRate: 102.063,
  convert: function() {
     cRate * currencyTextInput
  return exchangeRate.push(exchangeRate())
  }
  };
  </code></pre>
  
  <p>Basically, trying to have the user enter a number, validate that, then display that number (which will be usd) and multiply by each conversion rate and then display the results and the country/currency associated with the result in an ordered bullet list.  Hopefully that is possible with what I have or is possible to do.  I am just not sure how to push method data to an array and I need 2 bits of info from each. This is so aggravating, beginning web programming class my ass.</p>