前端反射:
html:
<li><a href="javascript:;" operation="executeCase">执行</a></li>
<li><a href="javascript:;" operation="deleteCase">删除</a></li>
// js代码: var operation = $(this).attr('operation'); // 找到operation属性, if (typeof (window[operation]) == "function") { //如果你这个变量是个函数function window[operation]() // ()执行这个函数 } function executeCase() {} function deleteCase() {}