473,692 Members | 2,444 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Text Scroller: scrolling stops in Firefox

Hi,

I have a script which works in both IE but is sluggish in Firefox.
The script is a simple text scroller.
It works perfectly in IE however in Firefox, the text scroll slower and
eventually just stops.

I would aprechiate it someone could look at the code below and maybe
see where the problem is?

Thank you in advance,
Micky

/*************** *************** *************** *************** *********/
<html>
<head>
<title>test</title>

<head></head>
<BODY >

<table bgcolor="00000" width="752" cellpadding="0" cellspacing="0"
border="0">

<tr>
<td>

<SCRIPT>

var text=new Array()
text[0]="testtestte st"
text[1]=" testtest test test test "
text[2]=" testtest test test test"

// Add a link for each message
var textlink=new Array()
textlink[0]="http://"
textlink[1]="http://"
textlink[2]="http://"

// Add a target for each link
// Possible values are "_blank", "_self", "_top", "_parent"
var texttarget=new Array()
texttarget[0]="_blank"
texttarget[1]="_blank"
texttarget[2]="_blank"

............
var translayersmax= Math.floor(tran slayerszone/translayerswidt h)
var translayersleft pos=0
var translayersopac ity=100
var translayersfact or=100/translayersmax
var translayerswidt hall=translayer smax*translayer swidth
var ie=document.all ?1:0
var ns6=document.ge tElementById&&! document.all?1: 0
var ns4=document.la yers?1:0
var browserinfos=na vigator.userAge nt
var opera=browserin fos.match(/Opera/)

getcontent()
function getcontent() {
...
<!-- table for scroll -->
if (ie || ns6) {
document.write( '<table cellpadding=0 cellspacing=0 border=0
height='+texthe ight+' width='+textwid th+'><tr><td>') ;
document.write( '<div id="marker" style="position :relative;
width:'+textwid th+';
height:'+texthe ight+'" ></div>');
document.write( '</td></tr></table>')
if (ns6) {
var tablewidth=text width-2*textborder
var tableheight=tex theight-2*textborder
}
else {
var tablewidth=text width
var tableheight=tex theight
}
document.write( '<div ID="roof" style="position :absolute;width :'
+tablewidth+'px ;height:'+table height+'px;bord er-style:solid;bor der-width:'+
textborder+'px; border-color:'+textbor dercolor+';back ground-color:'+textbgc olor+';
visibility:hidd en;overflow:hid den" onMouseOver="se tscrollready(0) "
onMouseOut="set scrollready(1)" >')
document.write( '<span ID="ticker"
style="position :absolute;top:0 px;left:0px;vis ibility:hidden" >'+content+'</span>')

if (ie && !opera) {
for (i=0;i<=transla yersmax;i++) {
document.write( '<span ID="trans'+i+' "
style="position :absolute;top:0 px;left:'+trans layersleftpos+' px;width:'+
translayerswidt h+'px;height:'+ tableheight+'px ;background-color:'+textbgc olor+';filter:a lpha(opacity='
+translayersopa city+');overflo w:hidden"> </span>')
translayersleft pos+=translayer swidth
translayersopac ity-=translayersfac tor
}
translayersleft pos=tablewidth-translayersleft pos

for (ii=0;ii<=trans layersmax;ii++) {
document.write( '<span ID="trans'+ii+' "
style="position :absolute;top:0 px;left:'
+translayerslef tpos+'px;width: '+translayerswi dth+'px;height: '+tableheight+' px;background-color:'+
textbgcolor+';f ilter:alpha(opa city='+translay ersopacity+');o verflow:hidden" >
</span>')
translayersleft pos+=translayer swidth
translayersopac ity+=translayer sfactor
}
}

if (ns6 && !opera) {
for (i=0;i<=transla yersmax-1;i++) {
document.write( '<span ID="transleft'+ i+'"
style="position :absolute;top:0 px;left:'+
translayersleft pos+'px;width:' +translayerswid th+'px;height:' +tableheight+'p x;background-color:'
+textbgcolor+';-moz-opacity:'+
translayersopac ity/100+';overflow: hidden"> </span>')
translayersleft pos+=translayer swidth
translayersopac ity-=translayersfac tor

if (translayersopa city<0) {translayersopa city=0.001}
}
translayersleft pos=tablewidth-translayersleft pos
translayersopac ity=0.001
for (i=0;i<=transla yersmax-1;i++) {
document.write( '<span ID="transright' +i+'"
style="position :absolute;top:0 px;left:'
+translayerslef tpos+'px;width: '+
translayerswidt h+'px;height:'+ tableheight+'px ;background-color:'+textbgc olor+';-moz-opacity:'
+translayersopa city/100+';"> </span>')
translayersleft pos+=translayer swidth
translayersopac ity+=translayer sfactor
}
}
document.write( '</div>')
if (ns6) {
document.write( '<span ID="tickersize "
style="position :absolute;top:0 px;left:-5000px;
visibility:hidd en">'+content+' </span>')
}
}

function doscroll(){
if (scrollready) {
if(ns4){
document.ticker .left+=-step;
if (document.ticke r.left<document .marker.pageX+1 *textborder) {
document.ticker .clip.left+=ste p;
}

document.ticker .clip.right+=st ep;
if(document.tic ker.left<-textcontentwidt h+document.mark er.pageX) {
document.ticker .left=textwidth +document.marke r.pageX-1*textborder;
document.ticker .clip.left=0
document.ticker .clip.right=0
}
}
if (ie) {
document.all.ti cker.style.posL eft+=-step
if (document.all.t icker.style.pos Left<-textcontentwidt h) {
document.all.ti cker.style.posL eft=textwidth
}
}
//
if (ns6) {
document.getEle mentById('ticke r').style.left= parseInt(docume nt.getElementBy Id('ticker').st yle.left)-step
if
(parseInt(docum ent.getElementB yId('ticker').s tyle.left)<-textcontentwidt h)
{
document.getEle mentById('ticke r').style.left= textwidth
}
}
timer=setTimeou t("doscroll()", 50)
}
else {
clearTimeout(ti mer)
}
}

function DL_GetElementLe ft(eElement) {
var nLeftPos = eElement.offset Left;
var eParElement = eElement.offset Parent;
while (eParElement != null) {

nLeftPos += eParElement.off setLeft;
eParElement = eParElement.off setParent;
}
return nLeftPos;
}

function DL_GetElementTo p(eElement) {
var nTopPos = eElement.offset Top;
var eParElement = eElement.offset Parent;
while (eParElement != null) {

nTopPos += eParElement.off setTop;
eParElement = eParElement.off setParent;
}
return nTopPos;
}

function initscroller(){
......
if (ns6) {
textcontentwidt h=document.getE lementById('tic kersize').offse tWidth
document.getEle mentById('roof' ).style.left=DL _GetElementLeft (document.getEl ementById('mark er'));
document.getEle mentById('roof' ).style.top=DL_ GetElementTop(d ocument.getElem entById('marker '));
document.getEle mentById('ticke r').style.left= textwidth
document.getEle mentById('ticke r').clip='rect( 0px,
'+textcontentwi dth+'px, '+(textheight)+ 'px, 0px)';
document.getEle mentById('roof' ).style.visibil ity="visible";
document.getEle mentById('ticke r').style.visib ility="visible" ;
}
doscroll()
}

function setscrollready( whatanswer) {
if (whatanswer==1) {
scrollready=tru e
checkscroll()
}
else {
scrollready=fal se
}
}

function checkscroll() {
clearTimeout(ti mer)
if (scrollready) {
doscroll()
}
}
function reopenpage() {
history.go(0)
}
window.onresize =reopenpage
window.onload=i nitscroller
</script>

</td>
</td>
</tr>
</table>
</body></html>

Jul 30 '05 #1
1 4594
Mickey <mi************ @gmail.com> wrote in message news:11******** *************@g 43g2000cwa.goog legroups.com...
Hi,

I have a script which works in both IE but is sluggish in Firefox.
The script is a simple text scroller.
It works perfectly in IE however in Firefox, the text scroll slower and
eventually just stops.

I would aprechiate it someone could look at the code below and maybe
see where the problem is?

Thank you in advance,
Micky


<SNIP>
The code as posted references undeclared variables and therefore is not testable.
Layer movement is slower under Gecko browsers, so I would guess that the relevant function is being called too often.

--
Stephen Chalmers
Jul 31 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
3066
by: Generale Cluster | last post by:
Hello, where can I find an horizontal scroller where I can set the scrolling direction from left to right? Thank you -- elimina unsampdoriano per rispondere via email
3
4715
by: Razvan | last post by:
Hello, Can somebody recommend me a Java Script scroller that can scroll an i-frame ? I tried the Tigra scroller (www.softcomplex.com/products/tigra_scroller/) but sometimes it does not appear at all on my web page (www.mihaiu.name). It doesn't seem to be reliable...
6
3892
by: sasan3 | last post by:
My mouse wheel scroller works in all Access windows except Visual Basic sub-windows. I am running Access 2002. Any ideas? Thanks. S
8
2375
by: marco | last post by:
Hi ! I have this part of code and i can not find out why the scroller is starting from left to right instead RIGHT to LEFT. This is the main part and the scroller is working fine but from the wrong side. //------------------------------------------ function start(){if(document.getElementById){tdiv6=document.getElementById('slider'); firstns6();}
5
4249
by: PythonistL | last post by:
I am a newbie with Javascript. I have this simple script for scrolling text <HTML> <HEAD> <TITLE>Scrolling Message Script</TITLE> <SCRIPT language="JavaScript"><!-- var msg = 'My scrolling text.. ' function scrollMsg(){
5
5893
by: eholz1 | last post by:
Hello Group, I am developing a web site using CSS. I have a div that has a vert scroll bar in it. The div works just fine (scroll up and down, etc). I have regular text (using <ptags) in the div, as well as an unordered list - with 3 or 4 list items. The display of text in the scroller div is just fine in firefox. When I look at the same page using IE 6 - my li text is larger (font size) than the text in the <ptags.
0
8969
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8811
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8810
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7635
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5822
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4327
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2242
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1962
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.