How do I get rid of this gap?

Posted on 2011-10-25
Last Modified: 2012-06-21
I've got this cool little JavaScript marquee / tickertape thing going on at, but there's only one problem. There's a gap between the beginning and end of the text and I'm wanting to close that.

My code is attached. Thoughts?
<table width="935" cellspacing="0" cellpadding="0" align="center">
<td class="top_header">
<script language="JavaScript1.2"> 
Cross browser Marquee script- © Dynamic Drive (
For full source code, 100's more DHTML scripts, and Terms Of Use, visit
Modified by jscheuer1 for continuous content. Credit MUST stay intact
//Specify the marquee's width (in pixels)
var marqueewidth="940px"
//Specify the marquee's height
var marqueeheight="23px"
//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=1
//configure background color:
var marqueebgcolor="#ffffff"
//Pause marquee onMousever (0=no. 1=yes)?
var pauseit=1
//Specify the marquee's content (don't delete <nobr> tag)
//Keep all content on ONE line, and backslash any single quotations (ie: that\'s great):
var marqueecontent='<nobr><?php require_once('marquee_text.php'); ?></nobr>'
var copyspeed=marqueespeed
var pausespeed=(pauseit==0)? copyspeed: 0
var iedom=document.all||document.getElementById
if (iedom)
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100px;left:-9000px">'+marqueecontent+'</span>')
var actualwidth=''
var cross_marquee, cross_marquee2, ns_marquee
function populate(){
if (iedom){
var initFill=(full==1)? '8px' : parseInt(marqueewidth)+8+"px"
actualwidth=document.all? temp.offsetWidth : document.getElementById("temp").offsetWidth
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
cross_marquee2=document.getElementById? document.getElementById("iemarquee2") : document.all.iemarquee2
cross_marquee2.innerHTML=cross_marquee.innerHTML=marqueecontent"px" //indicates following #1
else if (document.layers){
function scrollmarquee(){
if (iedom){
if (parseInt(<(actualwidth*(-1)+8))"px"
if (parseInt(<(actualwidth*(-1)+8))"px""px""px"
else if (document.layers){
if (ns_marquee.left>(actualwidth*(-1)+8))
if (iedom||document.layers){
with (document){
document.write('<table border="0" width="925" cellspacing="0" cellpadding="0"><td class="marquee">')
if (iedom){
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
write('<div id="iemarquee" style="position:absolute;left:0px;top:3px;display:inline;"></div>')
write('<div id="iemarquee2" style="position:absolute;left:0px;top:3px;display:inline;"></div>')
else if (document.layers){
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
write('<layer name="ns_marquee2" left=0 top=3 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')

Open in new window

Question by:brucegust
    LVL 11

    Accepted Solution

    replacing this line will do

    document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100px;left:-9000px;font-size:10px;">'+marqueecontent+'</span>')

    LVL 21

    Assisted Solution

    by:Kim Walker
    The table you've included in this post (which is set to 935 pixels wide) is nested inside a table that is 945 pixels wide which is nested inside a table that is 950 pixels wide. Your marquee div is 940 pixels wide. The white box behind the marquee is generated by the 950-pixel-wide table which has a deprecated bgcolor attribute set to white. You can eliminate the white space by increasing your marquee div to 950 pixels wide, too, which will push the tables it's nested inside to 950 pixels wide.

    Author Closing Comment

    It was lelvinwkw's suggestion that worked, although xmediaman had a very valid point in terms of the convoluted table widths which I have since corrected.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Suggested Solutions

    "That which we persist in doing becomes easier, not that the task itself has become easier, but that our ability to perform it has improved." Ralph Waldo Emerson Introduction: One of the wonderful things about the web is that it makes it s…
    When you need to keep track of a simple list of numbers or strings, the Array object is your most direct tool.  As we saw in my earlier EE Article (, typical array handling might look like this: (CODE) B…
    The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
    The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now