How do I make a simple scrolling text box in JavaScript

I have a project where we need to make a small box that vertically scrolls through a number of customer testimonials. I'm not sure scroll is the appropriate word, as I need basically one testimonial to be up, and after seven seconds, it switches to the next testimonial. I have an HTML document with all the testimonials written out and seperated by divs. I also don't want the testimonial text to be within my main html page, so I need to reference it from another HTML document.

So, is there a way to have these testimonials switch from one to the next based off divs? Thanks for the help, and I hope this was clearly communicated. This is my first posting.
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

numberkruncherConnect With a Mentor Commented:
How about something like this:
		<title>Demo Page</title>
		<style type="text/css">
			/* Use CSS to control visibility */
			div.testimonial {
				display: none;
			} {
				display: block;
		<script type="text/javascript">
			var activeTestimonial = 0, testimonialCount = 0;
			function onLoad() {
				/* Initialize count and timer. */
				var seconds = 5; // Every 5 seconds...
				setInterval(onTick, seconds * 1000);
			function onTick() {
				/* Move to next testimonial and update. */
				/* Wrap back to first one! */
				if (activeTestimonial >= testimonialCount)
					activeTestimonial = 0;
			function updateTestimonail() {
				var el = document.getElementById('testimonials').firstChild;
				testimonialCount = 0;
				/* Count testimonials and add 'active' to class name. */
				while (el) {
					if (el.tagName == 'DIV') {
						if (testimonialCount == activeTestimonial)
							el.className = 'testimonial active';
							el.className = 'testimonial';
					el = el.nextSibling;
	<body onload="onLoad();">
		<h1>Demo Page</h1>
		<div id="testimonials">
			<div class="testimonial">Great stuff!</div>
			<div class="testimonial">Excellent!</div>
			<div class="testimonial">Recommended!</div>

Open in new window

"So, is there a way to have these testimonials switch from one to the next based off divs?"

Sure, but you don't have to have the DIV code in the other file.  You could simply have a DIV structure in the main file, and then a simple javascript array of the various testimonials, separated by "Quote" and new line.  

Then the javascript just reads the next testimonial into the DIV layer (all you need is a name and ID for it) based on a timer.  That is how I would do it, and the text file for the testimonials would be a simple javascript array.  Can give an example if you want.
All Courses

From novice to tech pro — start learning today.