title: How to execute a jQuery code
body: <p>I have a jQuery code here given by a friend and I'm not sure how to make it work.
  I was told that I can save it as html as the code has a reference as external
  But when I did it didn't work. </p>
  
  <p>Here is the code:</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js" type="text/javascript"&gt;&lt;/script&gt;
  &lt;title&gt;tyu&lt;/title&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"&gt;
  &lt;style type="text/css"&gt; 
  #tintin
  {
      position:relative;
  color:white;
  font-size:18pt;
  font-style:bold;
  font-family:Calibri;
  width:800px;
  height:500px;
  }
  #text 
  {
      top:0px;
      position:absolute;
  filter:alpha(opacity=100);
  opacity:100;
  left:600px;
  }
  &lt;/style&gt;
  &lt;script type="text/javascript"&gt; 
  
  //var txt=['text 1','text 2', 'text 3', 'text 4', 'text 5', 'text 6', 'text 7', 'text 8', 'text 9', 'text 10'], init=0,i=0,k=0,speed=40,el;
  //var loopCount=1000;
  //var j=0;
  //var padd = 50; //set this to an approriate increment
  //function fade(){
  //init==0?i++:i--;
  //el.filters?el.style.filter='alpha(opacity='+i+')':el.style.opacity=i/100;
  //el.firstChild.nodeValue=txt[k];
  //if(i==100)init=1;
  //if(i==0) {init=0;k++;j++;
  //el.style.paddingLeft=50*k;
  //} 
  //if(k==txt.length)k=0;
  //if (j&lt;loopCount) setTimeout('fade()',speed);
  //}
  //window.onload=function(){
  //el=document.getElementById('tintin');
  //fade();
      //}
      $(document).ready(function () {
  
          var txt = ['text 1', 'text 2', 'text 3', 'text 4', 'text 5', 'text 6', 'text 7', 'text 8', 'text 9', 'text 10'];
          var k = -1;
          fade();
          function fade() {
              k++;
              if (k == 9) {
                  k = 0;
              }
              $("#text").text(txt[k]);
              $("#text").css("left", (600 - k * 100) + "px");
              $("#text").fadeTo(1, 100);
              console.log((600 - k * 100) + "px");
              console.log($("#text").css("left"));
              $("#text").css("top", (k * 100) + "px");
  
              var nl = "-=" + (k*100) + "px";
              console.log(nl);
  
              var nt = "-=" + (300 - k*100) + "px";
              var op = Math.floor((-($("#text").css("left").replace("px", "") - 600 - k * 100)) / 600) + .3;
              $("#text").animate({
                  left: "300px", //
                  opacity: op,
                  top: "300px"
              }, 1000);
  
              $("#text").animate({
                  left: nl, //
                  opacity: 0,
                  top: nt
              }, 1000);
              setTimeout(fade, 2000);
  
  
          }
      });
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;div id="tintin" style="color:#fff !important; background-color:blue;"&gt;
  &lt;div id="text"&gt;
  
  &lt;/div&gt;
  &lt;/div&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>