Coldfusion Scrolling Text

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
admoortownAsked:
Who is Participating?
 
duncancummingCommented:
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.

0
 
erikTsomikSystem Architect, CF programmer Commented:
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.