diff options
Diffstat (limited to 'usr/local/www')
-rwxr-xr-x | usr/local/www/javascript/ticker.js | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/usr/local/www/javascript/ticker.js b/usr/local/www/javascript/ticker.js index 77d3c63..8297c10 100755 --- a/usr/local/www/javascript/ticker.js +++ b/usr/local/www/javascript/ticker.js @@ -10,33 +10,39 @@ var copyspeed=speed; var pausespeed=(pauseit==0)? copyspeed: 0; var iedom=document.all||document.getElementById; -if (iedom) +if (iedom&&content) document.write('<span id="marquee-container">'+content+'</span>'); var actualwidth=''; var scroller; -if (window.addEventListener) - window.addEventListener("load", populatescroller, false); -else if (window.attachEvent) - window.attachEvent("onload", populatescroller); -else if (document.all || document.getElementById) - window.onload=populatescroller; +try { + if (window.addEventListener) + window.addEventListener("load", populatescroller, false); + else if (window.attachEvent) + window.attachEvent("onload", populatescroller); + else if (document.all || document.getElementById) + window.onload=populatescroller; +}catch(e){} function populatescroller(){ - scroller=document.getElementById? document.getElementById("scroller") : document.all.scroller; - scroller.style.left=parseInt(width)+8+"px"; - scroller.innerHTML=content; - document.getElementById("marquee-text"); - actualwidth=document.all? document.getElementById("marquee-text").offsetWidth : document.getElementById("marquee-text").offsetWidth; - lefttime=setInterval("scrollmarquee()",20); + try { + scroller=document.getElementById? document.getElementById("scroller") : document.all.scroller; + scroller.style.left=parseInt(width)+8+"px"; + scroller.innerHTML=content; + document.getElementById("marquee-text"); + actualwidth=document.all? document.getElementById("marquee-text").offsetWidth : document.getElementById("marquee-text").offsetWidth; + lefttime=setInterval("scrollmarquee()",20); + }catch(e){} } function scrollmarquee(){ - if (parseInt(scroller.style.left)>(actualwidth*(-1)+8)) - scroller.style.left=parseInt(scroller.style.left)-copyspeed+"px"; - else - scroller.style.left=parseInt(width)+8+"px"; + try { + if (parseInt(scroller.style.left)>(actualwidth*(-1)+8)) + scroller.style.left=parseInt(scroller.style.left)-copyspeed+"px"; + else + scroller.style.left=parseInt(width)+8+"px"; + }catch(e){} } if (iedom){ @@ -47,4 +53,4 @@ if (iedom){ document.write('</td></table>'); } -//-->
\ No newline at end of file +//--> |