日期:2014-05-17  浏览次数:20718 次

谁能告诉我这段代码是什么意思?在线等!!!
JScript code
<script type="text/javascript">

function addEvent(elem,type,fn){if(elem.nodeName==="A"&&type==="click"){elem.setAttribute("href","javascript:void(0)")};if(elem.addEventListener){elem.addEventListener(type,fn,false);return true;}else if(elem.attachEvent){elem['e'+type+fn]=fn;elem[type+fn]=function(){elem['e'+type+fn](window.event);}

elem.attachEvent("on"+type,elem[type+fn]);return true;}

return false;};

function slide(o){var handle=o.handle,content=o.content,mode=o.mode||"moseover",myClass=o.current,speed=o.speed,fn=o.fn,flag=0,timer;for(var i=0;i<handle.length;i++){(function(i){addEvent(handle[i],mode,function(){clearTimeout(timer);show(i);});})(i);}

function show(flag){var i=flag;for(var j=0;j<handle.length;j++){handle[j].className="";content[j].style.display="none";};handle[i].className=myClass;content[i].style.display="block";if(handle[i].nodeName==="A")handle[i].blur();(flag+1)==handle.length?flag=0:flag++;if(speed){timer=setTimeout(function(){show(flag)},speed);addEvent(content[i],"mouseover",function(){clearTimeout(timer)});addEvent(content[i],"mouseout",function(){clearTimeout(timer);timer=setTimeout(function(){show(flag)},speed)});};if(fn)fn();}

if(speed)show(flag);}

</script>



------解决方案--------------------
第一个是注册事件。。
下面2个和平常js 方法一样。。
------解决方案--------------------
下面的js是自动切换功能吧