title: 2 Identical javascripts don't run with jquery accordian
body: <p>Ok, here I have a Jquery Accordian with 2 tabs.</p>
  
  <p>1 is for <strong>SELL</strong> and the other one is <strong>BUY</strong>.Each one of them has it's own group of input boxes and javascript attached to them.</p>
  
  <p>Here's for the <strong>BUY</strong> tab</p>
  
  <p><em>Input Boxes:-</em></p>
  
  <pre><code>&lt;tr&gt;
              &lt;td&gt;BUY &lt;input type="text" name="buybtc" id="buybtc" class="validate[required] text-input" placeholder="amount" size="10"&gt; BTC &lt;/td&gt;
              &lt;td&gt;At Rate&lt;input type="text" name="rate" id="rate" class="validate[required] text-input" placeholder="rate" size="10"&gt;BTC/LTC&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
              &lt;td&gt;LTC You will give&lt;input type="text" name="giveltc" readonly id="giveltc" size="10"&gt;&lt;/td&gt;
              &lt;/tr&gt;
  </code></pre>
  
  <p><em>Javascript:-</em></p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
          window.onload = function(){
          var buybtc = document.getElementById('buybtc'), //get the amount BTC to be sold 
          giveltc = document.getElementById('giveltc'),
          rate = document.getElementById('rate');
  
          var constantNumber = 0.022632;
  
          rate.onkeyup = function () {
          var result = parseFloat(buybtc.value) * parseFloat(rate.value);
          giveltc.value = !isNaN(result) ? result : '';
              };
          }
  
          //sellbtc = buybtc
          //getltc = giveltc
          &lt;/script&gt;
  </code></pre>
  
  <p><strong>SELL</strong> Tab :-</p>
  
  <p><em>Input Boxes</em></p>
  
  <pre><code>&lt;tr&gt;
    &lt;td&gt;Sell &lt;input type="text" name="sellbtc" id="sellbtc" class="validate[required] text-input" placeholder="amount"&gt; BTC &lt;/td&gt;
    &lt;td&gt;At Rate&lt;input type="text" name="rates" id="rates" class="validate[required] text-input" placeholder="rate"&gt;LTC/BTC&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;LTC You will get&lt;input type="text" name="getltc" readonly id="getltc"&gt;&lt;/td&gt;
    &lt;/tr&gt;
  </code></pre>
  
  <p>Javascript :-</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
          window.onload = function(){
          var sellbtc = document.getElementById('sellbtc'), //get the amount BTC to be sold 
          getltc = document.getElementById('getltc'),
          rate = document.getElementById('rate');
  
          var constantNumber = 0.022632;
  
          rate.onkeyup = function () {
          var result = parseFloat(sellbtc.value) * parseFloat(rate.value);
          getltc.value = !isNaN(result) ? result : '';
              };
          }
          &lt;/script&gt;
  </code></pre>
  
  <p>The work of both these scripts is to calculate the total amount based on the principle amount and rate.The <strong>problem</strong> is, that when I put <em>only 1 javascript</em> in the page (for the buy tab)..everything works fine..i.e, the amount is calculated in the third box.But, the moment I place the javascript for the BUY tab..both the javascripts stop working, that means the final amount is not calculated in any of these tabs.</p>
  
  <p>How should I tackled this problem?
  Thanks.</p>
  
  <hr>
  
  <p>Updated:-</p>
  
  <pre><code>    &lt;script type="text/javascript"&gt;
          window.onload = function(){
            var sellbtc = document.getElementById('sellbtc'), //get the amount BTC to be sold 
            getltc = document.getElementById('getltc'),
            rate = document.getElementById('rate');
  
            var constantNumber = 0.022632;
  
            rate.onkeyup = function () {
              var result = parseFloat(sellbtc.value) * parseFloat(rate.value);
              getltc.value = !isNaN(result) ? result : '';
              };
          }
          &lt;/script&gt;
          &lt;script type="text/javascript"&gt;
          window.onload = function(){
            var buybtc = document.getElementById('buybtc'), //get the amount BTC to be sold 
            giveltc = document.getElementById('giveltc'),
            rateSell = document.getElementById('rateSell');
  
            var constantNumber = 0.022632;
  
            rate.onkeyup = function () {
              var resultSell = parseFloat(buybtc.value) * parseFloat(rateSell.value);
              giveltc.value = !isNaN(resultSell) ? resultSell : '';
              };
          }
  
          //sellbtc = buybtc
          //getltc = giveltc
          &lt;/script&gt;
  
  &lt;div id="accordion"&gt;
            &lt;h3&gt;Buy&lt;/h3&gt;
            &lt;div&gt;
              &lt;p&gt;
  
              &lt;form action="tradehandler.php?action=buy" method="post" id="formID"&gt;
              &lt;table&gt;
              &lt;tr&gt;
              &lt;td&gt;BUY &lt;input type="text" name="buybtc" id="buybtc" class="validate[required] text-input" placeholder="amount" size="10"&gt; BTC &lt;/td&gt;
              &lt;td&gt;At Rate&lt;input type="text" name="rateSell" id="rateSell" class="validate[required] text-input" placeholder="rate" size="10"&gt;BTC/LTC&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
              &lt;td&gt;LTC You will give&lt;input type="text" name="giveltc" readonly id="giveltc" size="10"&gt;&lt;/td&gt;
              &lt;/tr&gt;
  
              &lt;tr&gt;
              &lt;td&gt;&lt;input type="submit" name="submit"&gt;&lt;/td&gt;
              &lt;/tr&gt;
              &lt;/table&gt;
              &lt;/form&gt;
              &lt;/p&gt;
            &lt;/div&gt;
            &lt;h3&gt;Sell&lt;/h3&gt;
            &lt;div&gt;
              &lt;p&gt;
  
              &lt;form action="tradehandler.php?action=sell" method="post" id="formID"&gt;
    &lt;table&gt;
    &lt;tr&gt;
    &lt;td&gt;Sell &lt;input type="text" name="sellbtc" id="sellbtc" class="validate[required] text-input" placeholder="amount"&gt; BTC &lt;/td&gt;
    &lt;td&gt;At Rate&lt;input type="text" name="rate" id="rate" class="validate[required] text-input" placeholder="rate"&gt;LTC/BTC&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;LTC You will get&lt;input type="text" name="getltc" readonly id="getltc"&gt;&lt;/td&gt;
    &lt;/tr&gt;
  
    &lt;tr&gt;
    &lt;td&gt;&lt;input type="submit" name="submit"&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/table&gt;
    &lt;/form&gt;
              &lt;/p&gt;
            &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>