PDA

View Full Version : Cross browser Marquee script



Black Panther
05-02-2006, 10:56 AM
Can anybody tell me if there's probably a maximum length of the contents in the Cross browser Marquee script? I've just tried it and it works fine in IE, NS, Mozilla, but in the Opera browser (current version) it gets cut off at a certain position and starts from zero again...

jscheuer1
05-03-2006, 08:56 AM
Can anybody tell me if there's probably a maximum length of the contents in the Cross browser Marquee script? I've just tried it and it works fine in IE, NS, Mozilla, but in the Opera browser (current version) it gets cut off at a certain position and starts from zero again...

Sounds like you've answered your own question. The only way to tell for sure is to setup the script on an otherwise blank page, if you haven't already done so, and see if the problem in Opera persists. Also, I've found that with many of these type of scripts in Opera, it can help to put an additional div around the the whole thing:

<div style="position:relative;overflow:hidden;">

script or script's markup goes here

</div>

By "script or script's markup goes here", I mean the part of the script that generates its containers (often can be the entire script) or its HTML portion that hard codes them (whichever it has). I cannot be more specific because I am not certain which script you are talking about.

Warning: Please include a link to the DD script in question in your post. See this thread (http://www.dynamicdrive.com/forums/showthread.php?t=6) for the proper posting format when asking a question.

Black Panther
05-03-2006, 10:20 AM
I've used this one: http://www.dynamicdrive.com/dynamicindex2/cmarquee.htm

The result with an otherwise blank page was the same... in Opera it was cut off... and putting <div> around it didn't help either...

jscheuer1
05-03-2006, 04:39 PM
Well, how long is too long?

Please post a link to the page on your site that contains the problematic script so we can check it out.

Black Panther
05-04-2006, 07:24 AM
the entire text is 187 characters long... and it gets cut off in Opera at around 100 or 105...

jscheuer1
05-04-2006, 08:45 AM
I just did one that was only a little shy of 1800 characters, no problem in Opera. Somewhere higher, around 4000 characters? (when I went that high) it appeared to wrap once inside the little light cyan slot there that it runs in. Here is a demo (http://home.comcast.net/~jscheuer1/side/marq_h.htm) of @1800 characters. I've set it to stop at the end, and it appears to go all the way through. Find something interesting to do while you are waiting for it to scroll through.

Black Panther
05-04-2006, 11:11 AM
that's really strange... did you use a different script or something?
Is it possible that you post that maybe?

jscheuer1
05-04-2006, 04:17 PM
It is the same script (http://www.dynamicdrive.com/dynamicindex2/cmarquee.htm) you referenced, including the now deprecated language attribute and missing the now technically 'required' type attribute. The only difference from the original is that I did wrap it in a division:


<div style="position:relative;overflow:hidden;"><script language="JavaScript1.2">

/*
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
Credit MUST stay intact
*/

//Specify the marquee's . . .


. . .}
document.write('</td></table>')
}
}
</script></div>

All that did (I think) was get rid of the horizontal scrollbar from the bottom of the page. I also, of course, changed the maequeecontent variable to:


var marqueecontent='<nobr><font face="Arial">Lorem ipsum d . . . neque nonor et</font></nobr>'

And, I changed the scrollmarquee function to (additions red):


function scrollmarquee(){
if (iedom){
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed+"px"
else {
clearInterval(lefttime)
return;
cross_marquee.style.left=parseInt(marqueewidth)+8+"px"
}

}
else if (document.layers){
if (ns_marquee.left>(actualwidth*(-1)+8))
ns_marquee.left-=copyspeed
else
ns_marquee.left=parseInt(marqueewidth)+8
}
}

All that does is make it stop at the end of the first pass.

You can use your browser's 'view source' to see the entire markup and script. I'm thinking that there may be something about your marqueecontent variable that caused the problem. Perhaps a syntax error or, a line break. The entire marqueecontent variable must be on a single line in the source code.

Please post a link to the page on your site that contains the problematic script so we can check it out.