Solved

cross browser ticker.

Posted on 2004-04-20
5
327 Views
Last Modified: 2007-12-19
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
0
Comment
Question by:ehout
  • 2
  • 2
5 Comments
 
LVL 4

Expert Comment

by:apprenti
Comment Utility
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
(http://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>
0
 
LVL 3

Author Comment

by:ehout
Comment Utility
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
0
 
LVL 4

Accepted Solution

by:
apprenti earned 125 total points
Comment Utility
0
 
LVL 3

Author Comment

by:ehout
Comment Utility
Thanx for the reminder.

Kind regards.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now