We help IT Professionals succeed at work.

Coldfusion Scrolling Text

Medium Priority
520 Views
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
Comment
Watch Question

You can use Coldfusion to populate the javascript string.

e.g.
<cfquery name="getNews" datasource="dsn">
SELECT ID, Title
FROM News
</cfquery>

<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;
</cfoutput>
</script>

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.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.