container.onmouseover=stop;
stop后為什么不用加括號(hào)啊。stop不是方法嗎?
源碼
? ? ? ? var timer;
? ? ? ? function play(){
? ? ? ? ? timer=setInterval(function(){next.onclick()},1000);
? ? ? ? ? ? }?
? ? ? ? function stop(){
? ? ? ? ? ? clearInterval(timer);
? ? ? ? }
? ? ? ? play();
? ? ? ? container.onmouseover=stop;
? ? ? ? container.onmouseout=play;
2015-12-26
這是一種回調(diào)函數(shù)的使用方式,如果stop(),這是stop方法就被執(zhí)行了,但是如果寫(xiě)方法名stop,是事件觸發(fā)時(shí)才會(huì)調(diào)用stop方法