Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 5th, 2006, 05:35 AM
Authorized User
 
Join Date: Nov 2005
Location: mumbai, maharashtra, India.
Posts: 48
Thanks: 0
Thanked 0 Times in 0 Posts
Default using javascript ticker in asp.net c#

hello everybody,

this is the link
http://news.bbc.co.uk/
 as see this there is newsbar that is displaying the latest news
i want to do the same have the javascript for this but i want this script to acess database and display the latest data...

here is the html


<HTML>
<HEAD>
<title></title>
<meta http-equiv="content-type" ontent="text/html;charset=iso-8859-1">
</HEAD>
<body>
  <div class="ticki"><a class="tickl" id="tickerAnchor" style="TEXT-DECORATION: none" href="http://news.bbc.co.uk/" target="_top">
<span class="tickls">LATEST:&nbsp;</span></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 = "Recent:&nbsp;";

    var theSummaries = new Array();
    var theSiteLinks = new Array();
    var theItemCount = 4;


theSummaries[0] = "School students in Chile reject government offer aimed at ending protests.";
theSiteLinks[0] = "/2/hi/americas/5042758.stm";

theSummaries[1] = "Canadian police arrest at least 10 in anti-terror operation in Toronto.";
theSiteLinks[1] = "/2/hi/americas/5043408.stm";

theSummaries[2] = "Seven members of same family shot dead during apparent robbery in Indianapolis.";
theSiteLinks[2] = "/2/hi/americas/5043056.stm";

theSummaries[3] = "A cannabis plant extract provides pain relief after major surgery, research shows.";
theSiteLinks[3] = "/2/hi/health/5040960.stm";

startTicker();

//-->
</script>
</body>


how do i integrate this with my code behind to pass array values from database

Thanks and Regards,
vivek soni

Best Regards,
Vivek.
__________________
Best Regards,
Vivek.
 
Old June 5th, 2006, 12:07 PM
Friend of Wrox
Points: 4,332, Level: 27
Points: 4,332, Level: 27 Points: 4,332, Level: 27 Points: 4,332, Level: 27
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2003
Location: , NJ, USA.
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

Do not post the same topic in multiple forums:
http://p2p.wrox.com/topic.asp?TOPIC_ID=45227





Similar Threads
Thread Thread Starter Forum Replies Last Post
using javascript ticker in asp.net vivek_inos ASP.NET 1.0 and 1.1 Professional 1 June 5th, 2006 12:05 PM
using javascript ticker in asp.net vivek_inos ASP.NET 1.x and 2.0 Application Design 0 June 5th, 2006 05:29 AM
is it possible to use javascript+asp.net ? FlyingBear BOOK: Professional Ajax ISBN: 978-0-471-77778-6 1 April 28th, 2006 02:44 AM
javascript to asp.net bimboypogi ASP.NET 1.0 and 1.1 Professional 2 March 21st, 2005 02:49 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.