Back

News Flasher

 

 

This is another version of the news scroller. It's not to difficult to configure.  You can ad links to the flash messages

 

Message Link Width Height Speed
<div align="left">
<table border="3" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#800000" width="19%" bgcolor="#FFFF80" height="0">
<tr>
<td width="100%" height="1">
<script language="JavaScript1.2">


var delay=3000;
var flashNews=new Array()
begintag='<font face="Arial" size=2>'
flashNews[0]="Get the latest in Javascripts, HTML and Dynamic HTML scripts at <a href='http://www.Ultimatephp.com'>Ultimatephp.com!</a>"
flashNews[1]="Blah blah blah."
flashNews[2]="More blah blah blah."
flashNews[3]="Ad as many messages as you need."
closetag='</font>'

var fwidth='150px'
var fheight='75px'
var fadescheme=0
var fadelinks=1


var hex=(fadescheme==0)? 255 : 0
var startcolor=(fadescheme==0)? "rgb(255,255,255)" : "rgb(0,0,0)"
var endcolor=(fadescheme==0)? "rgb(0,0,0)" : "rgb(255,255,255)"

var ie4=document.all&&!document.getElementById
var ns4=document.layers
var DOM2=document.getElementById
var faderdelay=0
var index=0

if (DOM2)
faderdelay=2000

function changecontent(){
if (index>=flashNews.length)
index=0
if (DOM2){
document.getElementById("fscroller").style.color=startcolor
document.getElementById("fscroller").innerHTML=begintag+flashNews[index]+closetag
linksobj=document.getElementById("fscroller").getElementsByTagName("A")
if (fadelinks)
linkcolorchange(linksobj)
colorfade()
}
else if (ie4)
document.all.fscroller.innerHTML=begintag+flashNews[index]+closetag
else if (ns4){
document.fscrollerns.document.fscrollerns_sub.document.write(begintag+flashNews[index]+closetag)
document.fscrollerns.document.fscrollerns_sub.document.close()
}

index++
setTimeout("changecontent()",delay+faderdelay)
}


frame=20;

function linkcolorchange(obj){
if (obj.length>0){
for (i=0;i<obj.length;i++)
obj[i].style.color="rgb("+hex+","+hex+","+hex+")"
}
}

function colorfade() {
// 20 frames fading process
if(frame>0) {
hex=(fadescheme==0)? hex-12 : hex+12 // increase or decrease color value depd on fadescheme
document.getElementById("fscroller").style.color="rgb("+hex+","+hex+","+hex+")"; // Set color value.
if (fadelinks)
linkcolorchange(linksobj)
frame--;
setTimeout("colorfade()",20);
}

else{
document.getElementById("fscroller").style.color=endcolor;
frame=20;
hex=(fadescheme==0)? 255 : 0
}
}

if (ie4||DOM2)
document.write('<div id="fscroller" style="border:0px solid black;width:'+fwidth+';height:'+fheight+';padding:0px"></div>')

window.onload=changecontent
</script>


<ilayer id="fscrollerns" width=&{fwidth}; height=&{fheight};></p>
<layer id="fscrollerns_sub" width=&{fwidth}; height=&{fheight}; left=0 top=0></layer></ilayer>
</td>
</tr>
</table>
</div>
 

Place where needed in the HTML Document.

Copyright 2003 Ultimatephp.com