<html>
<head>
<script>
var tmrID=0;
var fDiv;
var oColor;
var nColor;
var flashnum=0;
var flashdelay=500;
var ntimes=10;
var ccount=0;
function FlashDiv(divid,backcolor)
{
nColor=backcolor;
if (tmrID!=0)
{
clearInterval(tmrID);
fDiv.style.backgroundColor=oColor;
tmrID=0;
}
fDiv=document.getElementById(divid);
if (fDiv)
{
oColor=fDiv.style.backgroundColor;
ccount=0;
tmrID=setInterval(doFlash,flashdelay);
}
}
function doFlash()
{
ccount++;
if (ccount>=ntimes)
{
clearInterval(tmrID);
tmrID=0;
}
//alert(fDiv.style.backgroundColor!=oColor);
fDiv.style.backgroundColor=fDiv.style.backgroundColor!=oColor || tmrID==0?oColor:nColor;
}
</script>
</head>
<body onLoad="FlashDiv('mycontent','#FF0000');">
<div id="mycontent">This is the content for the script</div>
</body>
</html>
|