?
Solved

cross browser ticker.

Posted on 2004-04-20
5
Medium Priority
?
354 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 4

Expert Comment

by:apprenti
ID: 10868314
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
ID: 10868640
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 500 total points
ID: 10869355
0
 
LVL 3

Author Comment

by:ehout
ID: 11050583
Thanx for the reminder.

Kind regards.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
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…

719 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