执行作为字符串存储的JavaScript代码如何执行作为字符串的JavaScript?function ExecuteJavascriptString(){
var s = "alert('hello')";
// how do I get a browser to alert('hello')?}
3 回答
慕码人8056858
TA贡献1803条经验 获得超6个赞
var theInstructions = "alert('Hello World'); var x = 100";var F=new Function (theInstructions);return(F());
添加回答
举报
0/150
提交
取消