我如何从文本字段自动计算表达式..是否有任何函数或类似的东西..
<input type="text" value="3+4" id="Txt">
var Result = Function_in_javascript(document.getElementById("Txt").value)
alert(Result )// 7
最佳答案
试试这个 eval(document.getElementById("Txt").value)
编辑:这是做什么用的?
关于javascript - 我如何自动计算文本字段中的表达式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11304090/