Click to See Complete Forum and Search --> : Rotating text and color


aljami
06-06-2003, 02:13 AM
Hi

I want to have a short message on screen for a second or so which then is replaced by another, again for a second or so, and again for a third and so on. Also the color for some messages should be different from the the others.

I remember seeing the code for this somewhere but cannot now find it. Can anyone point me in the right direction please?


Aljami :(

Asch
06-06-2003, 05:16 AM
I have this one... dont remember wher I took it but works fine ...
--------------------------------------------
var beforeMsg = "<center><font color=blue size=+2><b>";
var afterMsg = "</b></font></center>";
var msgRotateSpeed = 2000; // Rotate delay in milliseconds
var textStr = new Array();
textStr[0] = "Check out this script!";
textStr[1] = "Why not add it to your page?";
textStr[2] = "W3C-DOM compatible (NS6)";
textStr[3] = "You are using "+navigator.userAgent;
if (document.layers) {
document.write('<ilayer id="NS4message" height=25 width=100%><layer id="NS4message2" height=25 width=100%></layer></ilayer>')
temp = 'document.NS4message.document.NS4message2.document.write(beforeMsg + textStr[i++] + afterMsg);'+
'document.NS4message.document.NS4message2.document.close()';
}
else if (document.getElementById) {
document.write(beforeMsg + '<div id="message" style="position:relative;">IE division</div>' + afterMsg);
temp = 'document.getElementById("message").firstChild.nodeValue = textStr[i++];';
}
else if (document.all) {
document.write(beforeMsg + '<div id="message" style="position:relative;">IE division</div>' + afterMsg);
temp = 'message.innerHTML = textStr[i++];';
}
var i = 0;
function msgRotate() {
eval(temp);
if (i == textStr.length) i = 0;
setTimeout("msgRotate()", msgRotateSpeed);
}
window.onload = msgRotate;
------------------------------

cheers

asch
:D

aljami
06-06-2003, 08:04 AM
Hi asch

thanks will give ir a try.

Aljami