Ciao a tutti...
ho preso questo script (http://javascript.html.it/script/ved...-effetto-fade/) per inserirvi le mie news.
In pratica le news le recupero da un database MySql con una normalissima query ASP.
Il codice è questo (gli style non li ho ancora sistemati...):
codice:
<style>
#tic { border-style: dotted; border-width: 2px; background-color: #aabbcc; border-bottom-color: #887777; border: 1px #CEC3AD solid; color: #eeeeee; border-style: dotted; font-size:12px; padding:2px; width:120px; height: 260px; line-height:12px; }
#tic *{ font-size: 12px; margin:0px; padding:0px; display:none; }
#tic a { display:inline; }
</style>
<script type="text/javascript" language="JavaScript">
var list;
var tickerObj;
var hex = 255;
function fadeText(divId) {
if(tickerObj)
{
if(hex>0) {
hex-=5; // increase color darkness
tickerObj.style.color="rgb("+hex+","+hex+","+hex+")";
setTimeout("fadeText('" + divId + "')", fadeSpeed);
} else
hex=255; //reset hex value
}
}
function initialiseList(divId) {
tickerObj = document.getElementById(divId);
if(!tickerObj)
reportError("Could not find a div element with id \"" + divId + "\"");
list = tickerObj.childNodes;
if(list.length <= 0)
reportError("The div element \"" + divId + "\" does not have any children");
for (var i=0; i<list.length; i++) {
var node = list[i];
if (node.nodeType == 3 && !/\S/.test(node.nodeValue))
tickerObj.removeChild(node);
}
run(divId, 0);
}
function run(divId, count) {
fadeText(divId);
list[count].style.display = "block";
if(count > 0)
list[count-1].style.display = "none";
else
list[list.length-1].style.display = "none";
count++;
if(count == list.length)
count = 0;
window.setTimeout("run('" + divId + "', " + count+ ")", interval*1000);
}
function reportError(error) {
alert("Script non funzionante:\n\n" + error);
return false;
}
var interval = 8; // interval in seconds
var fadeSpeed = 60;
</script>
</head><body>
<div id="tic">
<%
set my_Conn = Server.CreateObject("ADODB.Connection")
my_Conn.Open strConnString
set srst = my_conn.execute("SELECT * FROM tabella ORDER BY ID DESC LIMIT 0,10")
While NOT srst.Eof
%>
●<% =srst("TITOLO") %><% =srst("TESTO") %>(<% =srst("DATA") %>)</p>
<%
srst.MoveNext
Wend
srst.Close
Set srst = Nothing
%>
</div>
<script type="text/javascript">
initialiseList("tic");
</script>
La pagina (di prova) è questa:
http://www.crealla.it/testmarquee.asp
Non trovo però il modo di formattare il testo (il titolo vorrei metterlo in grassetto, la data più piccola...)
Come faccio?