var flashTimer = null;
var flashState = flashCount = 0;
$ = function(el){ return document.getElementById(el); }
function flash(el)
{
if(flashState == 1)
{
$(el).style.backgroundColor = "#FFF";
flashState = 0;
}
else
{
$(el).style.backgroundColor = "#F00";
flashState = 1;
}
if(flashCount == 5)
{
$(el).focus();
clearTimeout(flashTimer);
flashCount = flashState = 0;
}
else
{
flashTimer = setTimeout("flash('"+el+"')",50);
flashCount++;
}
}
[Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]
Leave a reply