codice:
<HTML><HEAD><TITLE></TITLE>
<SCRIPT language=javascript>
<!--
function LPad(str,length,xchar){
var stringa = ''
if(str.length<length){
for(i=1;i<=length-str.length;i++){
stringa = stringa + xchar
}
stringa = stringa + str
return stringa
}
else{
return str
}
}
function Dec2Hex(dec){ //Converte un numero decimale (da 0 a 255) in una stringa che rappresenta un numero esadecimale
aHex = new Array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F')
c = 0
for(i=dec;i>=16;i=i-16){
c = c + 1
}
strHex = aHex[c] + aHex[i]
return strHex
}
function Hex2Dec(hex){ //Converte una stringa che rappresenta un numero esadecimale (da 0 a FF) in un numero decimale
aHex = new Array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F')
hex=LPad(hex,2,'0')
h1=hex.substr(0,1)
h1=h1.toUpperCase()
h2=hex.substr(1,1)
h2=h2.toUpperCase()
for(i=0;i<=aHex.length;i++){
if(aHex[i]==h1)d1=i
if(aHex[i]==h2)d2=i
}
d1 = d1*16
dec = d1+d2
return dec
}
function rgb2hex(r,g,b){ //Restituisce una stringa che rappresenta un colore in esadecimale composto da r g b
var strHex = ''
strHex = strHex + Dec2Hex(r)
strHex = strHex + Dec2Hex(g)
strHex = strHex + Dec2Hex(b)
strHex = '#'+strHex
return strHex
}
function hex2r(hexColor){ //Da un colore esadecimale restituisce il valore decimale del Rosso
xr = hexColor.substr(1,2)
r = Hex2Dec(xr)
return r
}
function hex2g(hexColor){ //Da un colore esadecimale restituisce il valore decimale del Giallo
xg = hexColor.substr(3,2)
g = Hex2Dec(xg)
return g
}
function hex2b(hexColor){ //Da un colore esadecimale restituisce il valore decimale del Blu
xb = hexColor.substr(5,2)
b = Hex2Dec(xb)
return b
}
function CreaSfumaturaH(qtaColori,hexDa,hexA){ //Restituisce un array di stringhe che rappresentano un colore in esadecimale in gradazione da hexDa a hexA
var stepX = (255/(qtaColori-1))
var sColore = new Array()
var cont = 0
rda = hex2r(hexDa)
gda = hex2g(hexDa)
bda = hex2b(hexDa)
ra = hex2r(hexA)
ga = hex2g(hexA)
ba = hex2b(hexA)
for(j=0;j<=255;j=j+stepX){
xr = Math.round(j/255*ra+(255-j)/255*rda)
xg = Math.round(j/255*ga+(255-j)/255*gda)
xb = Math.round(j/255*ba+(255-j)/255*bda)
sColore[cont] = rgb2hex(xr,xg,xb)
cont = cont+1
}
return sColore
}
function scrivi(idDiv,testo){ //Scrive in un <DIV>
if(document.getElementById){
document.getElementById(idDiv).innerHTML = testo
}
if(document.layers){
document.layers[idDiv].document.write(testo);
document.layers[idDiv].document.close();
}
}
//-------------------------------------------------------------------------------------------------
var scala = new Array()
scala = CreaSfumaturaH(20,'#FFFFFF','#FF0055') //IMPOSTAZIONE SFUMATURA (sfondo,testo)
var aNews = new Array() //TITOLI DA CICLARE
aNews[0] = 'Testo della prima notizia.'
aNews[1] = 'Testo della seconda notizia. con bold.'
aNews[2] = 'Questo è il testo della terza notizia.'
aNews[3] = 'Qui (la quarta notizia) ho scritto in italic'
aNews[4] = 'Quinta e ultima notizia... non so più cosa scrivere!!'
//impostazione tabella dove verranno visualizzate le notizie
txtTabUp = '<table border="1" bgcolor="'+ scala[0]+ '" width="200" height="50"><tr><td align="center" valign="middle" bgcolor="'+ scala[0]+ '" width="200" height="50">'
txtTabDw = '</td></tr></table>'
txtTabUp = ''
txtTabDw = ''
function fadeNews(n,c,dir){
ritardo = 0
if(!n)n=0
if(n>=aNews.length)n=0
if(!c)c=0
if(!dir)dir=false
if(c>=scala.length){
c=(scala.length-1)
dir = true
ritardo = 3000
}
if(c<0){
c=0
dir = false
n++
ritardo = 500
}
txtFade = txtTabUp+'<font face="verdana" size="2" color="'+ scala[c]+ '">'+aNews[n]+'</font>'+txtTabDw
scrivi('divnews',txtFade)
if(!dir)
c++
else
c--
setTimeout('fadeNews('+n+','+c+','+dir+')',10+ritardo)
}
//-->
</SCRIPT>
</HEAD>
<BODY bgColor=#ffffff onload=fadeNews();>
<DIV id=divnews
style="LEFT: 50px; WIDTH: 200px; POSITION: absolute; TOP: 50px; HEIGHT: 50px"
name="divnews"></DIV></BODY></HTML>
prendilo direttamente dalla textarea premendo il tastino quote in basso a destra,