View Full Version : Translucent scroller

05-24-2006, 02:44 AM
Translucent Scroller (http://www.dynamicdrive.com/dynamicindex2/translucentscroll.htm)

How would I make this look to an external file for the content? I would really like it to point to a perl script that will house the data in a database. Is this easly done? Any suggestions? I understand perl, but not JavaScript.

Thank You,


05-24-2006, 07:38 AM
I'm not too good with perl, but the trick is basically to output the scroller contents dynamically:

var scrollercontent=new Array()
//Define scroller contents. Extend or contract array as needed
scrollercontent[0]='Visit our partner site <a href="http://freewarejava.com">Freewarejava.com </a>for free Java applets!'
scrollercontent[1]='Got JavaScript? <a href="http://www.javascriptkit.com">JavaScript Kit</a> is the most comprehensive JavaScript site online.'
scrollercontent[2]='Link to Dynamic Drive on your site. Please visit our <a href="http://www.dynamicdrive.com/link.htm">links page</a>.'

In PHP for example, you can create a PHP that does this, then call it as an external JavaScript file proceeding the rest of the scroller script:

<script type="text/javascript" src="contents.php"></script>

A helpful tutorial to read is External JavaScript and PHP. (http://www.javascriptkit.com/javatutors/externalphp.shtml)