Coldfusion Scrolling Text

Posted on 2009-02-12
Last Modified: 2013-12-24
Hi i was wondering if anyone could help me!

im trying to create a scrolling news section on our home page, the code needs to read the news headline from the database though and it will vertically move the news items up and if the user clicks on an item it will take them to the detail page.  when the scroller is finished it would need to start automatically.

i seem to find ones that are all static text within the javascript function.

Thanks in advance
Question by:admoortown
    LVL 19

    Expert Comment

    LVL 16

    Accepted Solution

    You can use Coldfusion to populate the javascript string.

    <cfquery name="getNews" datasource="dsn">
    SELECT ID, Title
    FROM News

    <script type="text/javascript">
    <cfoutput>var jsNews = new Array(#getNews.RecordCount#);</cfoutput>
    <cfoutput query="getNews">
     var arrayLine = new Array(2);
     arrayLine[0] = #GetNews.ID#;
     arrayLine[1] = #GetNews.Title#;
     jsNews[#getNews.CurrentRow#] = arrayLine;

    That code's a bit of a mess, but basically you're using cfoutput to populate javascript variables.  I've done the above as a 2D array, but you can do it however you need to for your javascript to do the scrolling text to work.


    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Join & Write a Comment

    Suggested Solutions

    When setting up new project requests for our site, one of the most powerful tools our team has available to use is Axure ( It’s a tool for creating software and web prototypes that can function and interact as if it were the a…
    Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
    The purpose of this video is to demonstrate how to automatically show related posts at the bottom of a blog post in WordPress. This will be demonstrated using a Windows 8 PC. Plugin “Yet Another Related Posts Plugin” will be used. Go to your…
    The purpose of this video is to demonstrate how to prevent comment spam on a WordPress Website. This will be demonstrated using a Windows 8 PC. Plugin Akismet will be used. Go to your WordPress login page. This will look like the following: myw…

    733 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now