troubleshooting Question

News Ticker

Avatar of Fidelisme
Fidelisme asked on
JavaScript
8 Comments1 Solution371 ViewsLast Modified:
I have the following javascript..it displays a news ticker..
is there a way to retreive its news  from some database (instead of changing the news manually here)? how?
thnx


<script language="javascript" type="text/javascript">

function IMG1_onclick() {
}

function Hilite(obj)
{
      obj.style.background = 'highlight';
      obj.style.border = '1px solid threedhighlight';
      obj.style.borderTop = '1px solid threedshadow';
      obj.style.borderLeft = '1px solid threedshadow';
}

function Restore(obj)
{
      obj.style.color  = '';
      obj.style.background  = 'threedface';
      obj.style.border = '1px solid threedface';
}

</script>
                <div class="ticki" style="font-weight: normal; font-style:italic; font: verdana; font-size: 10pt; width: 629px; color: #ffffff;
                    height: 18px">
                    <div id="tickerAnchor">
                    </div>
                </div>

                <script language="JavaScript" type="text/javascript">
              <!--
            // Ticker startup
            function startTicker()
            {
                  theCurrentStory     = -1;
                  theCurrentLength    = 0;
                            if (document.getElementById) {      
                            theAnchorObject     = document.getElementById("tickerAnchor");
                              runTheTicker();         
                         }
                  else {
                        document.write("<code>.ticki{display:none;}.ticko{border:0px; padding:0px;}</code>");
                        return true;
                  }
            }
           function runTheTicker()
            {
                  var myTimeout;  
                 if(theCurrentLength == 0)
                  {
                        theCurrentStory++;
                        theCurrentStory      = theCurrentStory % theItemCount;
                        theStorySummary      = theSummaries[theCurrentStory].replace(/&quot;/g,'"');            
                        theTargetLink        = theSiteLinks[theCurrentStory];
                        theAnchorObject.href = theTargetLink;
                        thePrefix            = "<span class=\"tickls\" color:#010006 >" + theLeadString + "</span>";
                  }
                  theAnchorObject.innerHTML = thePrefix +
                  theStorySummary.substring(0,theCurrentLength) + whatWidget();
                  if(theCurrentLength != theStorySummary.length)
                  {
                        theCurrentLength++;
                        myTimeout = theCharacterTimeout;
                  }
                  else
                  {
                        theCurrentLength = 0;
                        myTimeout = theStoryTimeout;
                  }
                  setTimeout("runTheTicker()", myTimeout);
            }
            function whatWidget()
            {
                  if(theCurrentLength == theStorySummary.length)
                  {
                        return theWidgetNone;
                  }

                  if((theCurrentLength % 2) == 1)
                  {
                        return theWidgetOne;
                  }
                  else
                  {
                        return theWidgetTwo;
                  }
            }
                </script>

                <script language="JavaScript" type="text/javascript">
                  <!--

                  var theCharacterTimeout = 50;
                  var theStoryTimeout     = 5000;
                  var theWidgetOne        = "_";
                  var theWidgetTwo        = "-";
                  var theWidgetNone       = "";
                  var theLeadString       = "&nbsp;";
                  var theSummaries = new Array();
                  var theSiteLinks = new Array();

                  var theItemCount = 3;
                        theSummaries[0] = "This is my first ticker news. News 1! ";
                        theSiteLinks[0] = "/6054958.stm";
                  
                        theSummaries[1] = "And this is my second ticker news. News 2!";
                        theSiteLinks[1] = "/6054814.stm";
                  startTicker();
                  
                </script>
ASKER CERTIFIED SOLUTION
Ivo Stoykov

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 8 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros