espy69
03-19-2006, 09:03 PM
I have this horizontal scroller that works fine in internet explorer but not Firefox and I haven't got a clue why. Can anyone help please?
Head Script
<head>
<SCRIPT language=JavaScript1.2>
// CSM Change
// "Guess" at the font width, if the font of "ticktext" changes, this may
//need
// to change as well
var fontWidth = 6.3;
var time;
// CSM Change End
var l1 = 0; // left of ticker in pixel, or 0 to position relative
var t1 = 0; // top of ticker in pixel, or 0 to position relative
var w1 = 780; // width of ticker in pixel
var ie = document.all ? true : false;
var first = true;
var l2 = l1 + w1;
var l3 = l1 - l2;
var l = l2;
function tickinit() {
if (ie) {
if (l1 == 0 && t1 == 0) {
pos = document.all['tickpos'];
l1 = getLeft(pos);
t1 = getTop(pos);
}
ticktext.style.posTop = t1;
}
else {
if (l1 == 0 && t1 == 0) {
pos = document.anchors['tickpos'];
l1 = pos.x;
t1 = pos.y;
}
document.ticktext.pageY = t1;
}
l2 = l1 + w1;
l3 = l1 - l2;
l = l2;
time = setInterval('tick()', 10);
}
function getLeft(ll) {
if (ll.offsetParent)
return (ll.offsetLeft + getLeft(ll.offsetParent));
else
return (ll.offsetLeft);
}
function getTop(ll) {
if (ll.offsetParent)
return (ll.offsetTop + getTop(ll.offsetParent));
else
return (ll.offsetTop);
}
function tick() {
l = l - 1;
cl = l1 - l;
cr = 780 - l;
if (ie) {
ticktext.style.posLeft = l;
ticktext.style.posTop = t1;
ticktext.style.clip = "rect(auto "+cr+"px auto "+cl+"px)";
if (first) ticktext.style.visibility = "visible";
}
else {
document.ticktext.pageX = l;
document.ticktext.clip.left = cl;
document.ticktext.clip.right = cr;
if (first) document.ticktext.visibility = "show";
}
first = false;
// CSM Change
// Reset ticker if the whole message has been displayed
if((cr - 780) / fontWidth > document.all("ticktext").innerHTML.length)
{
tickReset();
tickinit();
}
// CSM Change End
}
// CSM Change
function tickReset() {
clearTimeout(time);
l1 = 0; // left of ticker in pixel, or 0 to position relative
t1 = 0; // top of ticker in pixel, or 0 to position relative
w1 = 780; // width of ticker in pixel
first = true;
l2 = l1 + w1;
l3 = l1 - l2;
l = l2;
}
// CSM Change End
// End -->
</SCRIPT></head>
Body Text
<BODY onload=tickinit()>
<DIV id=ticktext
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; VISIBILITY: hidden; FONT-FAMILY:
verdana; POSITION: absolute"><NOBR>
My text here span></NOBR> </DIV>
Head Script
<head>
<SCRIPT language=JavaScript1.2>
// CSM Change
// "Guess" at the font width, if the font of "ticktext" changes, this may
//need
// to change as well
var fontWidth = 6.3;
var time;
// CSM Change End
var l1 = 0; // left of ticker in pixel, or 0 to position relative
var t1 = 0; // top of ticker in pixel, or 0 to position relative
var w1 = 780; // width of ticker in pixel
var ie = document.all ? true : false;
var first = true;
var l2 = l1 + w1;
var l3 = l1 - l2;
var l = l2;
function tickinit() {
if (ie) {
if (l1 == 0 && t1 == 0) {
pos = document.all['tickpos'];
l1 = getLeft(pos);
t1 = getTop(pos);
}
ticktext.style.posTop = t1;
}
else {
if (l1 == 0 && t1 == 0) {
pos = document.anchors['tickpos'];
l1 = pos.x;
t1 = pos.y;
}
document.ticktext.pageY = t1;
}
l2 = l1 + w1;
l3 = l1 - l2;
l = l2;
time = setInterval('tick()', 10);
}
function getLeft(ll) {
if (ll.offsetParent)
return (ll.offsetLeft + getLeft(ll.offsetParent));
else
return (ll.offsetLeft);
}
function getTop(ll) {
if (ll.offsetParent)
return (ll.offsetTop + getTop(ll.offsetParent));
else
return (ll.offsetTop);
}
function tick() {
l = l - 1;
cl = l1 - l;
cr = 780 - l;
if (ie) {
ticktext.style.posLeft = l;
ticktext.style.posTop = t1;
ticktext.style.clip = "rect(auto "+cr+"px auto "+cl+"px)";
if (first) ticktext.style.visibility = "visible";
}
else {
document.ticktext.pageX = l;
document.ticktext.clip.left = cl;
document.ticktext.clip.right = cr;
if (first) document.ticktext.visibility = "show";
}
first = false;
// CSM Change
// Reset ticker if the whole message has been displayed
if((cr - 780) / fontWidth > document.all("ticktext").innerHTML.length)
{
tickReset();
tickinit();
}
// CSM Change End
}
// CSM Change
function tickReset() {
clearTimeout(time);
l1 = 0; // left of ticker in pixel, or 0 to position relative
t1 = 0; // top of ticker in pixel, or 0 to position relative
w1 = 780; // width of ticker in pixel
first = true;
l2 = l1 + w1;
l3 = l1 - l2;
l = l2;
}
// CSM Change End
// End -->
</SCRIPT></head>
Body Text
<BODY onload=tickinit()>
<DIV id=ticktext
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; VISIBILITY: hidden; FONT-FAMILY:
verdana; POSITION: absolute"><NOBR>
My text here span></NOBR> </DIV>