标签:style blog color io ar for div sp cti
function addClass(obj,aclass){ if(obj.className == ‘‘){ obj.className = aclass; }else{ var arr = obj.className.split(‘ ‘); var _index = arrIndexOf(arr,aclass); if(_index == -1){ obj.className += ‘ ‘+aclass; } } } function removeClass(obj,aclass){ if(obj.className!=‘‘){ var arr = obj.className.split(‘ ‘); var _index = arrIndexOf(arr,aclass); if(_index != -1){ arr.splice(_index,1); obj.className = arr.join(‘ ‘); } } } function arrIndexOf(arr,v){ for(var i=0;i<arr.length;i++){ if(arr[i] == v){ return i; } } return -1; };
标签:style blog color io ar for div sp cti
原文地址:http://www.cnblogs.com/xiaoxiaosha/p/3969715.html