两次点击事件进行切换 var toggle = (function () { var a = true; return function (fn1, fn2) { a = !a; var toggler = function () { if (a) { return fn1; } else { return fn2; } }; return this.onclick = toggler(); } })(); 使用: var div = document.getElementsByTagName(…