JS工具类——高亮度指定的元素
functionHighLight(){}; HighLight.options = { id : null, className : null, interval : 255, times : 3000 }; HighLight.prototype = { exe :function(options) { var_options = {}; if(typeof(options) == 'object') { _options.id = options.id||HighLight.options.id; _options.className = options.className||HighLight.options.className; _options.interval = options.interval||HighLight.options.interval; _options.times = options.times||HighLight.options.times; } if(_options.id==null||!$(_options.id)) { alert('必须指定要高亮度显示的元素ID!'); return false; }else if(!_options.className||typeof(_options.className)!='string'||_options.className.strip()=='') { alert('请指定高亮度显示的CSS名称!'); return false; } var elt = $(_options.id); if(elt.highLightHandle!=null)return; elt.highLightHandle = setInterval(function() { Element.toggleClassName(elt, _options.className); }, _options.interval); window.setTimeout(function() { clearInterval(elt.highLightHandle); Element.removeClassName(_options.className); elt.removeAttribute('highLightHandle'); }, _options.times); return true; } };