Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Javascript scroller in Firefox

Status
Not open for further replies.
Mar 11, 2004
127
GB
I'm trying to get a text scroller to wrok on a site, and it works fine in IE, but isn't visable in FF. Is this type of scroller on usable in IE?

Thanks,
Ant

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"[URL unfurl="true"]http://www.w3.org/TR/html4/loose.dtd">[/URL]
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<SCRIPT LANGUAGE="JavaScript1.2">
<!-- Original:  Ernst Straka (ernst.straka@central-europe.basf.org) -->
<!-- Web Site:  [URL unfurl="true"]http://www.rs-systems.at/straka[/URL] -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! [URL unfurl="true"]http://javascript.internet.com[/URL] -->

<!-- Begin
var l1 =   10; // left of ticker in pixel, or 0 to position relative
var t1 =   125; // top of ticker in pixel, or 0 to position relative
var w1 = 600; // 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;
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 - 0.5;
if (l < l3) l = l2;
cl = l1 - l;
cr = l2 - 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;
}
//  End -->
</script>

</head>

<body OnLoad="tickinit()">

<a name="tickpos"> </a>

<div id="ticktext" style=" position:absolute; font-family:Times New Roman; font-size:14pt; font-style:italic; color:#339933; visibility:hidden;">
<b><nobr>The art of knowing.....      the science of ingredients.</nobr></b>
</div>


</body>
</html>
 
Oops.. sorry, this is where I normally come, didn't think to look for that.

Will go there now. :D
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top