Credit Card Consolidation - Debt Consolidation - Debt Consolidation - Debt Consolidation - Wordpress Themes

PDA

View Full Version : Why isn't text changing color please?


Jen-
Nov 19th 2006, 12:34 am
Does anyone know why this working copy is honoring the text in the array but not changing text color? Please let me know, thank you very much.


<SCRIPT type="text/javascript">
arr = new Array(
["<span syle='color: rgb(300,0,0)'>text1</span>"],
["<span syle='color: rgb(0,0,300)'>text2</span>"],
["<span syle='color: rgb(0,0,180);'>text3</span>"],
["text number 60"]);

function rotatetext(){
document.getElementById("arr").innerHTML = arr[new Date().getSeconds()][0];
setTimeout('rotatetext()',1000);}
</SCRIPT>
<body>
<div id="arr">
<SCRIPT type="text/javascript">rotatetext()</SCRIPT></div>

adrianctn
Nov 19th 2006, 5:38 am
Shouldn't it be something like:

document.getElementById("arr").innerHTML = arr[floor(3*random())];

arr[floor(3*random())] returns an arr[i] value, where i=0,3


Regards,

Adrian

Jen-
Nov 19th 2006, 1:07 pm
Nevermind, found something else that works much better.