title: Javascript Opacity Change
body: <p>Okay, I've made some changes, fixed some problems, but now it doesn't go though all the letters, some of the letters are made visible, and then the script stops. Also, how would I make the letters fade in? I thought I had it to, but the script doesn't pause for some reason, and you can't see the fade.</p>
  
  <pre><code>&lt;script type="text/javascript" &gt;
  
          //alert("Script Loaded");
  
          var $TotalLetters = 16,
          $SwappedLets = 0,
          $L1 = false,
          $L2 = false,
          $L3 = false,
          $L4 = false,
          $L5 = false,
          $L6 = false,
          $L7 = false,
          $L8 = false,
          $L9 = false,
          $L10 = false,
          $L11 = false,
          $L12 = false,
          $L13 = false,
          $L14 = false,
          $L15 = false,
          $L16 = false,
          $RanNum = 0,
          $Holderval = 0;
  
          window.onload = function DOL() {
              DoOnLoad()
          }
  
          function DoOnLoad() { 
              //alert("DoOnLoad");
              /* Change the opacity of every letter randomly,
              CAN CHANGE IN SMALL TAG */
  
              if ($SwappedLets &lt;= $TotalLetters + 1) {
                  $RanNum = Math.floor(Math.random()*17); 
                  //alert(window["$L" + $RanNum]);
                   if (window["$L" + $RanNum] == false) {
                      window["$L" + $RanNum] = true;
                      OPIncre($RanNum);
                  }
              }
  
          } 
  
          function OPIncre(RN) {
              if (document.getElementById("tL" + RN).style.opacity &lt;= 1) {
                  document.getElementById("tL" + RN).style.opacity = $Holderval + 0.001;
                  $Holderval = $Holderval + 0.001;
                  window.setTimeout(OPIncre(RN),600);
              }
              else {
                  $SwappedLets = $SwappedLets + 1;
                  $Holderval = 0;
                  window.setTimeout(DoOnLoad,500);    
              }
          } 
  
      &lt;/script&gt;
  </code></pre>
  
  <p>----OLD:</p>
  
  <p>I'm new at Javascript, and I'm having trouble getting the script to change html element's opacity randomly. The opacity of the elements by default is set to 0 in css. I've tried looking around and have yet to find a solution. I'm not getting any error's in Firefox's Javascript error console. Is there anything that is obviously wrong?</p>
  
  <pre><code>&lt;script type="text/javascript" &gt;
          /*alert("Script Loaded");*/
          var $TotalLetters = 16,
          $SwappedLets = 0,
          $L1 = false,
          $L2 = false,
          $L3 = false,
          $L4 = false,
          $L5 = false,
          $L6 = false,
          $L7 = false,
          $L8 = false,
          $L9 = false,
          $L10 = false,
          $L11 = false,
          $L12 = false,
          $L13 = false,
          $L14 = false,
          $L15 = false,
          $L16 = false,
          $RanNum = 0;
  
          window.onload = function DOL() {
              DoOnLoad()
          }
  
          function DoOnLoad() {
              /*alert("DoOnLoad");*/
              /* Change the opacity of every letter randomly,
              CAN CHANGE IN SMALL TAG */
  
              if ($SwappedLets &lt;= $TotalLetters + 1) {
                  $RanNum = Math.floor(Math.random()*17);
                  /*alert(window["$L" + $RanNum]);*/
                  if (window["$L" + $RanNum] == false) {
                      window["$L" + $RanNum] = true;
                      OPIncre($RanNum);
                  }
              }
  
          }
  
          function OPIncre(RN) {
              while (document.getElementById("tL" + RN).style.Opacity &lt;= 1) {
                  document.getElementById("tL" + RN).style.Opacity = document.getElementById("tL" + RN).style.Opacity + 0.1;
              }
              $SwappedLets = $SwappedLets + 1;
              window.setTimeout(DoOnLoad,500);
          }
      &lt;/script&gt;
  </code></pre>