Notices

Great community. Great ideas.

Welcome to ASP/Free, a community dedicated to helping beginners and professionals alike in improving their knowledge of Microsoft's development and administration technologies. Sign up today to gain access to the combined insight of tens of thousands of members.

Thread: news ticker?

Results 1 to 6 of 6
Share This Thread →
  1. #1
    aditya1_in is offline Registered User
    Join Date
    Feb 2005
    Posts
    62
    Rep Power
    0

    news ticker?

    where should i start reading about how to develop news ticker, any links
    am searching thru google as i write this but anything would be really helpful

    something like bbc news ticker
    btw: can we do it thru asp?

  2. #2
    aditya1_in is offline Registered User
    Join Date
    Feb 2005
    Posts
    62
    Rep Power
    0

    how to direct to the website

    the news ticker is running in an asp page
    how do i make it run in a horizontal bar that is approx the size of an address bar, just a little bit bigger in height
    thank u
    Last edited by aditya1_in; February 25th, 2005 at 12:42 AM. Reason: needs modifications

  3. #3
    Yeruhn's Avatar
    Yeruhn is offline Contributing User
    Join Date
    Feb 2004
    Location
    Netherlands
    Posts
    542
    Rep Power
    238
    The source for the bbc news ticker is in the page itself. Just right click and view source.

  4. #4
    selwonk's Avatar
    selwonk is offline Contributing User
    Join Date
    Jun 2004
    Posts
    3,072
    Rep Power
    189
    The actual ticker code itself is at this URL:

    http://news.bbc.co.uk/nol/ukfs_news/...age/ticker.stm
    http://www.MapDays.com | Find events wherever, whenever you want them


  5. #5
    selwonk's Avatar
    selwonk is offline Contributing User
    Join Date
    Jun 2004
    Posts
    3,072
    Rep Power
    189
    In fact, the entire code is quite small:
    Code:
    <!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
    <html>
    <head>
    <title></title>
    <meta http-equiv="content-type" content="text/html;charset=iso-8859-1" />
    <link type="text/css" rel="stylesheet" href="/nol/shared/css/news.css" />
    
    </head>
    
    <body>
    <div class="ticki"><a id="tickerAnchor" href="#" target="_top" class="tickl"></a></div>
    <script language="JavaScript" type="text/javascript">
    <!--
    // Ticker startup
    function startTicker()
    {
     // Define run time values
     theCurrentStory	 = -1;
     theCurrentLength	= 0;
     // Locate base objects
     if (document.getElementById) { 
    	  theAnchorObject	 = document.getElementById("tickerAnchor");
       runTheTicker();	
       }
     else {
    			document.write("<style>.ticki{display:none;}.ticko{border:0px; padding:0px;}</style>");
    			return true;
     }
    }
    // Ticker main run loop
    function runTheTicker()
    {
     var myTimeout;  
     // Go for the next story data block
     if(theCurrentLength == 0)
     {
      theCurrentStory++;
      theCurrentStory	  = theCurrentStory % theItemCount;
      theStorySummary	  = theSummaries[theCurrentStory].replace(/&quot;/g,'"');  
      theTargetLink		= theSiteLinks[theCurrentStory];
      theAnchorObject.href = theTargetLink;
      thePrefix 	  = "<span class=\"tickls\">" + theLeadString + "</span>";
     }
     // Stuff the current ticker text into the anchor
     theAnchorObject.innerHTML = thePrefix + 
     theStorySummary.substring(0,theCurrentLength) + whatWidget();
     // Modify the length for the substring and define the timer
     if(theCurrentLength != theStorySummary.length)
     {
      theCurrentLength++;
      myTimeout = theCharacterTimeout;
     }
     else
     {
      theCurrentLength = 0;
      myTimeout = theStoryTimeout;
     }
     // Call up the next cycle of the ticker
     setTimeout("runTheTicker()", myTimeout);
    }
    // Widget generator
    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	   = "LATEST:&nbsp;";
    
     var theSummaries = new Array();
     var theSiteLinks = new Array();
    
     var theItemCount = 4;
    
     
      theSummaries[0] = "China asks Taiwan to consider more direct commercial flights between the countries.";
      theSiteLinks[0] = "/1/hi/world/asia-pacific/4296507.stm";
     
      theSummaries[1] = "Ecuador's former defence minister is arrested for allegedly authorising an arms deal.";
      theSiteLinks[1] = "/1/hi/world/americas/4296201.stm";
     
      theSummaries[2] = "Vietnam reports a new bird flu case, as international conference discusses action.";
      theSiteLinks[2] = "/1/hi/world/asia-pacific/4296495.stm";
     
      theSummaries[3] = "US court dismisses bankruptcy case brought by Russian oil giant Yukos. ";
      theSiteLinks[3] = "/1/hi/business/4296425.stm";
     
    
     startTicker();
     
     //-->
     </script>
    
    
    </body>
    </html>

  6. #6
    Phoenix's Avatar
    Phoenix is offline Web-Standards Evangelist
    Join Date
    Nov 2003
    Posts
    1,522
    Rep Power
    14
    NB: The arrays bit is filled via server-side generation.

Share This Thread →

Become Part of This Conversation

Join NowFor Free!

Similar Threads

  1. News Page Help
    By Rampage in forum ASP Development
    Replies: 2
    Last Post: June 2nd, 2004, 09:09 AM
  2. Get the first 40 chars from a news item.
    By javiwankenobi in forum ASP Development
    Replies: 3
    Last Post: May 18th, 2004, 10:51 AM
  3. News Page
    By badboypolar in forum ASP Development
    Replies: 3
    Last Post: April 20th, 2004, 03:15 PM
  4. Selecting Random News Stories
    By igotdamaged in forum HTML, JavaScript And CSS Help
    Replies: 1
    Last Post: February 15th, 2004, 08:33 PM
  5. News Feeds in ASP?
    By Steve Schofield in forum ASP Development
    Replies: 2
    Last Post: December 16th, 2000, 10:25 AM

ASP Free Advertisers and Affiliates