function switchNoteColor(obj) {
var currentColor = rgbToHex(jQuery(obj).css('color'));
if (currentColor == '#000000') {
jQuery(obj).css('color', '#ff0000');
}
else {
jQuery(obj).css('color', '#000000');
}
}
function rgbToHex(rgb) {
if (/^#[0-9a-f]{3}([0-9a-f]{3})?$/i.test(rgb)) {
return rgb;
}
rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
return "#" +
("0" + parseInt(rgb[1], 10).toString(16)).slice(-2) +
("0" + parseInt(rgb[2], 10).toString(16)).slice(-2) +
("0" + parseInt(rgb[3], 10).toString(16)).slice(-2);
}
var timer;
toggleTimer();
function toggleTimer()
{
if (document.getElementById("<%=fullDataEntryNotes.ClientID%>")) {
var fullDataEntryNotes = document.getElementById("<%=fullDataEntryNotes.ClientID %>");
switchNoteColor(fullDataEntryNotes);
}
timer = window.setTimeout('toggleTimer()', 750);
}
The HTML code breaks my post, so let me explain it here. Create a div with text inside, styled initially in black (#000000). Every 750 milliseconds, the color toggles between black and red.