模拟JQ的toggle
function t1(){ alert("111");}function t2(){ alert("222");}function t3(){ alert("333");}function iTestDo(){ var num = 0; numAdd = function(){num++;}; function doFun(){ if(arguments.length>1){ arguments[num](); numAdd(); if(num > arguments.length-1){ num = 0; } } } return doFun;}var iTest = iTestDo();
在页面上只需要iTest(t1,t2,t3)即可
TAG: