Page 1 of 1

Creating a "videprinter" style news headline scrip

Posted: Wed Sep 21, 2005 7:57 am
by Galey1981
Hello all

I am trying to build a php script that displays the headline of a news story in a videprinter style i.e. letter by letter. I've got a mysql database with a news table in it, with the fields id, headline, story. There's about 6 entries in here.

On my home page i'd love to be able to display the headline, in the letter by letter style and once it's spelled out the next one appears in its place doing the same thing. So basically just the headlines are looped one after the other. But whilst this headline is getting typed out i need it to be dynamic - so when you click the headline it dynamically loads the story.

I can do a basic news script with headlines one underneath each other without movement, and do this for several of my sites. But would really like this printing out / typing effect for each header in a loop, on the same line.

I assume javascript would come into play to simulate this.

Does anyone have any scripts which do the above - or can point me to a good tutorial. i've found lots of scripts which just produce javascript headlines, but these arent database driven (stored in an array) and arent linkable.

Thanks all in advance! :D

Posted: Wed Sep 21, 2005 8:07 am
by feyd
here's the quick and dirty idea:
  • you output x number of headlines and links to the story into a javascript array.
  • using [urlhttp://devguru.com/technologies/javascript/10905.asp]setTimeout()[/url] and/or setInterval() and DHTML to write successive letters from the current headline to an anchor via the innerHTML property. DHTML can change the href the link goes to as well.
  • add a longer delay between headlines
  • possibly use XMLHTTP to load more headlines and/or the story while continuing to display more headlines....