View Full Version : Help or Replacement of Marquee Tag

Jim Weinberg
09-24-2013, 12:41 PM
I'm doing some work for a local non-profit and they've asked me to put together a webpage that has a video clip, and an audio clip with the words to the audio running under the control box. I've put the page together using a marquee tag to scroll the words, and (despite what I've heard) it seems to work fine in all major browsers including Safari.

Here's my problem: The audio clip has a 20 second musical lead in (before the words actually start). I'd like to delay the start of the marquee accordingly. I've tried a couple of things and they don't seem to work. Can anyone help me out with this?

BTW, I know using a <marquee> tag is considered a no-no, so if anyone has a javascript routine that will do the same thing, please let me know. I've looked at the Marquee and Marquee II scripts, but they don't really do what I need. The Marquee II script apparently only scrolls up and down and the Marquee script doesn't have a startup delay.

Here's excerpts from the code:

<style type="text/css">
.html-marquee {height:20px;width:410px;font-family:Times;font-size:14px;color:000000;}
<script src="marque.js"></script>

<table bgcolor="#6b8ab6" border=5 bordercolor="#2b405b"><tr><td>
<embed src="ASongOfSpring.mp4" type="video/mp4" width="400" height="240"></embed>
<EMBED src="ASongOfSpring.mp3" AUTOSTART="True" LOOP="true" bgcolor="#FEF4E4" height="16" width="410">
document.write('<marquee class="html-marquee" direction="left" behavior="scroll" scrollamount="3">' + lyrics + '</marquee>');

The .js file contains the text of the audio assigned to the variable "lyrics".


09-24-2013, 01:48 PM
You should just add this to the marqee:


Information from: http://www.hscripts.com/tutorials/html/marquee2.php

09-24-2013, 03:14 PM
If I read that correctly, that will only give a 20 millisecond delay between each incremental movement of the marquee, and cannot be used to delay the onset of the marquee without making each subsequent movement take that long as well, and might not affect the initial movement. For 20 seconds it would have to be 20000, not 20.

It could work out though, if it does effect the initial movement and can be removed or changed after the marquee starts. And if, this is the big one, it works cross browser. Not all of the attributes of the marquee tag do.

That said, if the tag does what you want, it can be used, and support for it has broadened since its introduction many years ago as what was at first an IE only feature. So you can try:

document.write('<marquee id="lyricsmarquee" scrolldelay="20000" class="html-marquee" direction="left" behavior="scroll" scrollamount="3">' + lyrics + '</marquee>');
setTimeout(function(){document.getElementById('lyricsmarquee').setAttribute('scrolldelay', 0 , 0);}, 19000);

Those red values may need to be played with to get the desired effect. Or you could try using the scrollamount:

document.write('<marquee id="lyricsmarquee" class="html-marquee" direction="left" behavior="scroll" scrollamount="0">' + lyrics + '</marquee>');
setTimeout(function(){document.getElementById('lyricsmarquee').setAttribute('scrollamount', 3 , 0);}, 20000);

That would probably be more straightforward if it works. I cannot predict how cross browser any of the above will be. Or if it will even work at all in any browser.

The marquee script you mentioned is cross browser and can be delayed. I have a modified version of it that allows for that:


Use your browser's "View Source" to get the code. Notice this part:

Cross browser Marquee script- Dynamic Drive (www.dynamicdrive.com)
For full source code, 100's more DHTML scripts, and Terms Of Use, visit http://www.dynamicdrive.com
Modified by jscheuer1 for continuous content. Credit MUST stay intact

//Specify the marquee's width (in pixels)
var marqueewidth="300px"
//Specify the marquee's height
var marqueeheight="25px"
//Specify the marquee's marquee speed (larger is faster 1-10)
var marqueespeed=3
//Specify initial pause before scrolling in milliseconds
var initPause=0
//Specify start with Full(1)or Empty(0) Marquee
var full=0
//configure background . . .

Set that to 20000 and you will have a 20 second delay.

09-24-2013, 03:47 PM
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<style type="text/css">

#m1 {
position:relative;left:100px;top:100px;width:600px;height:20px;border:solid red 1px;background-Color:#FFFFCC;

#m1 DIV {


<div id="m1" onmouseover="zxcMarquee.Pause('m1')" onmouseout="zxcMarquee.Scroll('m1')">
<div onmouseover="zxcMarquee.Pause('m1')" >Some Text</div>

<script type="text/javascript">
// Simple Marquee. (24-September-2013)
// by: Vic Phillips - http://www.vicsjavascripts.org.uk/

var zxcMarquee={

var o=this['zxc'+id],oop=this;
o?o.to=setTimeout(function(){ oop.scroll(o); },ms||500):null;

var o=this['zxc'+id];

var id=o.ID,ms=o.ScrollDuration,srt=o.AutoStart,r=o.Repeat,m=document.getElementById(id),s=m?m.getElementsByTagName('DIV')[0]:null;
if (s){

this.animate(o,o.a,o.a[4],o.a[3],new Date(),o.ms*Math.abs((o.a[3]-o.a[4])/o.a[5])+10);

var oop=this,ms=new Date()-srt,n=(t-f)/mS*ms+f;
if (isFinite(n)){
if (ms<mS){
o.to=setTimeout(function(){ oop.animate(o,a,f,t,srt,mS); },10);
else {


ID:'m1', // the unique ID name of the marquee DIV. (string)
ScrollDuration:10, //(optional) the scroll duration in secconds. (number, default = 10)
AutoStart:20, //(optional) the auto scroll start delay in seconds. (number, default = no auto start)
Repeat:false //(optional) repeat scroll after n seconds. (number, default = false = no repeat)


Jim Weinberg
09-24-2013, 07:50 PM

It's always nice to work with a genius. Used the scrollamount mod and it works fine ... in all browsers. I'm going to try your marqueeh script, though, just to do away with the tag. Many thanks.

Vic. Tried your suggestion but couldn't get it to work. Not sure why. Thanks just the same.