title: Javascript Error: Undefined or not an object
body: <p>I am writing a javascript for a Ticker and i am getting some runtime error on the page</p>
  
  <p>When started debugging with VS2008 it displays</p>
  
  <p><strong>Microsfot JS runtime Error: tickerText Undefined</strong></p>
  
  <p>Script as below:</p>
  
  <pre><code>&lt;style type="text/css"&gt;
  #ticker-area, #ticker-area ul li a {font-size:13px;font-family:Arial, Helvetica, sans-serif;;font-weight:normal;}
  &lt;/style&gt;&lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js"&gt;&lt;/script&gt;
  
  &lt;style type="text/css"&gt;
  a:link, a:visited {text-decoration:none} 
  a:hover {text-decoration:none;}
  &lt;/style&gt;
  
  &lt;script type="text/javascript"&gt;
  var tickerText = 0;
  function createTicker(){
  // put all list elements within #ticker-area into array
  var tickerLIs = $("#ticker-area ul").children();
  tickerItems = new Array();
  tickerLIs.each(function(el) {
  tickerItems.push( jQuery(this).html() );
  });
  i = 0
  rotateTicker();
  }
  
  function rotateTicker(){
  if( i == tickerItems.length ){
  i = 0;
  }
  tickerText = tickerItems[i];
  c = 0;
  typetext();
  setTimeout( "rotateTicker()", 5000 );
  i++;
  }
  
  var isInTag = false;
  function typetext() {
  var thisChar = tickerText.substr(c, 1);
  if( thisChar == '&lt;' ){ isInTag = true; }
  if( thisChar == '&gt;' ){ isInTag = false; }
  $('#ticker-area').html("&amp;nbsp;" + tickerText.substr(0, c++));
  if(c &lt; tickerText.length+1)
  if( isInTag ){
  typetext();
  }else{
  setTimeout("typetext()", 28);
  }
  else {
  c = 1;
  tickerText = "";
  }
  }
  
  $(document).ready(function() {
  var soapEnv =
  "&lt;soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'&gt; \
  &lt;soapenv:Body&gt; \
  &lt;GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'&gt; \
  &lt;listName&gt;Alerts&lt;/listName&gt; \
  &lt;viewName&gt;&lt;/viewName&gt; \
  &lt;viewFields&gt; \
  &lt;ViewFields&gt; \
  &lt;FieldRef Name='Title' /&gt; \
  &lt;FieldRef Name='Link' /&gt; \
  &lt;FieldRef Name='ID' /&gt; \
  &lt;/ViewFields&gt; \
  &lt;/viewFields&gt; \
  &lt;rowLimit&gt;6&lt;/rowLimit&gt; \
  &lt;/GetListItems&gt; \
  &lt;/soapenv:Body&gt; \
  &lt;/soapenv:Envelope&gt;";
  
  $.ajax({
  url: "_vti_bin/lists.asmx",
  type: "POST",
  dataType: "xml",
  data: soapEnv,
  complete: processResult,
  contentType: "text/xml; charset=\"utf-8\""
  });
  
  });
  
  function processResult(xData, status) { 
  $(xData.responseXML).find("z\\:row").each(function() { 
  
  var url = "/Lists/Alerts/DispForm.aspx?ID=" + $(this).attr("ows_ID");
  
  
  
  var liHtml = "&lt;a href='" + url + "' style='color:#000000;'&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"+ $(this).attr("ows_Title") + "...&lt;/a&gt;"; 
  $("#listticker").append(liHtml); 
  
  }); 
  createTicker();
  }
  &lt;/script&gt;
  
  &lt;div id="ticker-area" style="font-size:13px;overflow:hidden;color: #EEFFFF" width="100%"&gt;
  &lt;marquee id="listticker" class="hiddenlink" direction="left" scrollamount="4" loop=infinite HSPACE=10 onmouseover="this.stop()" onmouseout="this.start()"&gt;&lt;/marquee&gt;&lt;/div&gt;
  </code></pre>
  
  <p>please help me on this</p>
  
  <p>Thanks in advance</p>