<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>myPage Title (TechZone Scripts)</title>
<style type="text/css">
.texto{
font-family: arial, serif, verdana, tahoma;
font-size: 8pt;
text-color: dark; // cor inicial do texto
}
</style>
<script type="text/javascript">
<!--
var timerID = 0;
var tStart = null; // valor inicial do contador
var timeOut = 1000; // em milisegundos
function updateTextColor() {
coractual = document.getElementById('texto').style.color;
if(coractual=='red')
//se estiver vermelho, coloca em preto
document.getElementById('texto').style.color='black';
else
//se estiver preto, coloca em vermelho
document.getElementById('texto').style.color='red';
}
function UpdateTimer() {
if(timerID) {
clearTimeout(timerID);
clockID = 0;
}
if(!tStart)
tStart = new Date();
updateTextColor();
timerID = setTimeout("UpdateTimer()", timeOut);
}
function Start() {
tStart = new Date();
timerID = setTimeout("UpdateTimer()", timeOut);
}
function Stop() {
if(timerID) {
clearTimeout(timerID);
timerID = 0;
}
tStart = null;
}
//-->
</script>
</head>
<body>
<p><span id="texto" onmouseover="Start()" onmouseout="Stop()">Texto de demonstração, um mero exemplo da aplicação do script ;)</span></p>
</body>
</html>