function executeEval(){ let evalCodeElt = document.getElementById("eval_code"); let evalCode = evalCodeElt.value; // 如果不把开头的eval去掉的话直接执行会被执行两遍 evalCode = evalCode.replace(/^eval/, ""); try{ evalCodeElt.value = eval(evalCode); }catch (e) { alert("执行报错了:" + e); } }