方法1:
function evil(fn) { var Fn = Function; return new Fn('return ' + fn)(); } //或者直接调用 var str=new Function('return ' + data)();
方法2:
function eval1 (str) { var script = document.createElement('script'); script.type="text/javascript"; script.text=str; document.getElementsByTagName('head')[0].appendChild(script); document.head.removeChild(document.head.lastChild); }