我想这样iterate("option","TagName",[RMPNone(),RMINone(),RMFMNone(),wecharBlock()]);function iterate(name, z, fun) { i = 0; console.log(name); if (z == "TagName") { y = document.getElementsByTagName(name); len = y.length; console.log(RMPNone()); } if (z == "ClassName") { y = document.getElementsByClassName(name); len = y.length; } for (; i < len; i++) { y[i].onclick = function () { for (i = 0; i < fun.length; i++) { fun[4]; } } }}