Good morning,
I'm trying to change the color text of atext[i] value when the "atim[i]+showtime" value is < "now"....
But if i assign the atext[i] value to a new var "ops" and change the color with string ops.style.color = 'red'; the script doesn't work.
Opening the error console of Firefox the error logged is ops.style is undefined....
Someone can help me pls ^^ ???
I'm trying to change the color text of atext[i] value when the "atim[i]+showtime" value is < "now"....
But if i assign the atext[i] value to a new var "ops" and change the color with string ops.style.color = 'red'; the script doesn't work.
Opening the error console of Firefox the error logged is ops.style is undefined....
Someone can help me pls ^^ ???
Code:
var atext = new Array(); var atim = new Array() var otext = "Ragazze Impegnate: \n"; document.getElementById("girlvalue").value = otext; var showtime = 5500; // milliseconds //var showtime = 600000 // 10 minutes window.setInterval("showtext()",1000); // refresh every 1 second function showtext() { var now = new Date().getTime(); var string = otext; for (var i =0; i <= atext.length; i++) { if ((atim[i] + showtime) > now) { string = string + '\n' + atext[i]; // string = string.replace(/\s+/g," "); } else if ((atim[i] + showtime) <= now) { var ops = atext[i]; ops.style.color = 'red'; string = string + '\n ' + ops; } document.getElementById("girlvalue").value = string; } } function addItem() { var b = document.getElementById("girl").value; atext.push(b); var now = new Date().getTime(); atim.push(now); document.getElementById("girl").value = document.getElementById("girl").value; }
Comment