Solved

cross browser ticker.

Posted on 2004-04-20
5
346 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 125 total points
ID: 10869355
0
 
LVL 3

Author Comment

by:ehout
ID: 11050583
Thanx for the reminder.

Kind regards.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
This article discusses how to implement server side field validation and display customized error messages to the client.
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…
Suggested Courses

617 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