Link to home
Start Free TrialLog in
Avatar of ehout
ehout

asked on

cross browser ticker.

Hi,

On my employer's website (www.levob.nl) I have a scrolling text in the upper right corner. To bad it only seems to run in IE (Mozilla Firebird complains about errors). Can anybody help in making this script cross browser compatible?

--------Begin code------------
<table width="350" border="0" align="right">
        <tr>
          <td>
<script language="JavaScript1.2">

var marqueewidth=300
var marqueeheight=20
var speed=5
var marqueecontents='<font face="verdana" font size=-2>Wegens technische werkzaamheden zijn de Levob websites donderdag 22 april van 18:00 uur tot 22:00 uur niet beschikbaar!             Onze excuses voor het ongemak.</font>'

if (document.all)
document.write('<marquee scrollAmount='+speed+' style="width:'+marqueewidth+'">'+marqueecontents+'</marquee>')

function regenerate(){
window.location.reload()
}
function regenerate2(){
if (document.layers){
setTimeout("window.onresize=regenerate",450)
intializemarquee()
}
}

function intializemarquee(){
document.cmarquee01.document.cmarquee02.document.write('<nobr>'+marqueecontents+'</nobr>')
document.cmarquee01.document.cmarquee02.document.close()
thelength=document.cmarquee01.document.cmarquee02.document.width
scrollit()
}

function scrollit(){
if (document.cmarquee01.document.cmarquee02.left>=thelength*(-1)){
document.cmarquee01.document.cmarquee02.left-=speed
setTimeout("scrollit()",100)
}
else{
document.cmarquee01.document.cmarquee02.left=marqueewidth
scrollit()
}
}

window.onload=regenerate2
</script></td>
        </tr>
      </table>
<ilayer width=&{marqueewidth}; height=&{marqueeheight}; name="cmarquee01">
<layer name="cmarquee02"></layer>
</ilayer>

--------End code-------

Thanx in advance

Kind regards
Avatar of apprenti
apprenti

That script is from Dynamic Drive. Note that you must not remove copyright and credit notices from scripts that you post here, or use elsewhere.

Anyway, here's a minimum change version which should be okay in Firefox (suggest you leave the credit in).

<table width="350" border="0" align="right">
        <tr>
          <td>
<script language="JavaScript1.2">
/*
Cross browser marquee script  
© Dynamic Drive (www.dynamicdrive.com)
For full source code, installation instructions,
100's more DHTML scripts, and Terms Of
Use, visit dynamicdrive.com

Modified by apprenti
(https://www.experts-exchange.com/Web/Web_Languages/JavaScript/M_1163695.html) to work in Gecko
*/
var marqueewidth=300
var marqueeheight=20
var speed=5
var marqueecontents='<font face="verdana" font size=-2>Please do not remove copyright and credit

notices from scripts. Thank you.</font>'

if (document.getElementById && !window.opera)
document.write('<marquee scrollAmount='+speed+'

style="width:'+marqueewidth+'">'+marqueecontents+'</marquee>')

function regenerate(){
window.location.reload()
}
function regenerate2(){
if (document.layers){
setTimeout("window.onresize=regenerate",450)
intializemarquee()
}
}

function intializemarquee(){
document.cmarquee01.document.cmarquee02.document.write('<nobr>'+marqueecontents+'</nobr>')
document.cmarquee01.document.cmarquee02.document.close()
thelength=document.cmarquee01.document.cmarquee02.document.width
scrollit()
}

function scrollit(){
if (document.cmarquee01.document.cmarquee02.left>=thelength*(-1)){
document.cmarquee01.document.cmarquee02.left-=speed
setTimeout("scrollit()",100)
}
else{
document.cmarquee01.document.cmarquee02.left=marqueewidth
scrollit()
}
}

window.onload=regenerate2
</script></td>
        </tr>
      </table>
<ilayer width=&{marqueewidth}; height=&{marqueeheight}; name="cmarquee01">
<layer name="cmarquee02"></layer>
</ilayer>
Avatar of ehout

ASKER

Thanx for the quickt replay.
Got it this way from an acquintance, so did not know the origin. However, the script is only used for a couple of days once a while to display a notification of maintenance to our customers.

But unfortunately the script still does not seem to work outside IE?

Kind regards
ASKER CERTIFIED SOLUTION
Avatar of apprenti
apprenti

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ehout

ASKER

Thanx for the reminder.

Kind regards.