Webmastering and HTML Articles/Tutorials

QUOTE(Jim Campton @ May 24 2008, 12:12 PM)
Can anyone help me with the script for the auto scrolling lyrics for the automated jukebox? I can't seem to find the script for it anywhere on the website.
Hi Jim,

Actually I never posted the script publicly at all, so you wouldn't have found it anywhere.
Although I don't know the reason why, nobody has ever asked for it before now. You are the first!
But since you want it, I'll supply it. There's a first time for everything I guess! laugh.gif

I use javascript. So, if any site visitor has javascript disabled in their browser, they will not see any autoscrolling. Nowadays it's foolish for anybody to disable javascript, since it's in such wide use, but there are unfortunately some "paranoids" lurking out there that still do, thus ruining their web browsing experience at an untold number of web sites on the net.

Anyway, include the following javascript code at some point following the <body> tag of the web page you want to autoscroll...

<script language="javascript" type="text/javascript">
iPosition = 0;  iLength=254; bscroll = true;  function switchscroll(atag)
bscroll = !bscroll;  atag.innerText = bscroll ? 'Autoscroll on/off' : 'Autoscroll on/off'; return false;
function scrollinit()  // section below initiates the scrolling and continues the scrolling to end of page
scrollTo(0, 10000);  lyrics_height = document.body.scrollTop+document.body.offsetHeight; scrollTo(0,0);  
function timer() // section below sets the timer and determines the delay and steps - you can change the values below
iPosition++;  setTimeout('timer()', 500);  progress = (iPosition/iLength)*100;  if (iLength > 0)    
thissec = iPosition/iLength;  lastsec = (iPosition-1)/iLength; scrollperc = thissec-lastsec;
if (bscroll) scrollBy(0, (lyrics_height-(document.body.offsetHeight/2))*scrollperc);    
setTimeout('scrollinit()', 50);setTimeout('timer()', 10000);

In the first line of the above javascript, there is a section that reads bscroll = true
The "true" value initiates an immediate autoscroll (immediate that is, based on the delay value set in the timer function in the javascript). The "true" value causes the script to autostart as soon as the page loads. This is how I use it in the Automated Jukebox script at my site for the scrolling lyrics, with timer and delay values adjusted for each song lyrics page accordingly, to give it a "somewhat" Karaoke effect for each song, as the song plays.

There is another page I used it with, for one of my former customers, seen here. In that case, I've changed the value of bscroll to bscroll = false in the above javascript. So, you must actually click the [Autoscroll on/off] link in the center iFrame that contains the biography for Apostle Hicks on that page to initiate the scrolling manually.

Now, on to the link itself...

Again, after the <body> tag on the same page, and after the point where the above javascript code was placed, insert the following link code (clicking the link will toggle auto scrolling on or off)...

[ <a href='.' onclick='return switchscroll(this);'>Autoscroll on/off</a> ]

That's it! It's really very basic, as you can see.

QUOTE(Jim Campton @ May 24 2008, 12:12 PM)
Thank you Tom for the script for the jukebox, it will make a great addition to our church website www.amo1stbaptist.org Thank you to anyone who can help with the scrolling script!

You are very welcome, Jim!
And I will be checking from time to time to see how you are progressing toward getting an Automated Jukebox working at your site at www.amo1stbaptist.org!

Take care,
Phzzz (aka Nunzio; aka Tom; aka Scruffy)