Description Evaluates JScript code. Syntax eval(codestring) The codestring argument is a String object that contains valid JScript code. This string is parsed by the JScript parser and executed. Res The eval function allows dynamic execution of JScript source code. For example, the following code creates a new variable mydate that contains a Date object: eval("var mydate = new Date();"); The code passed to the eval method is executed in the same context as the call to the eval method.
Description Evaluates JScript code. Syntax eval(codestring) The codestring argument is a String object that contains valid JScript code. This string is parsed by the JScript parser and executed. Res The eval function allows dynamic execution of JScript source code. For example, the following code creates a new variable mydate that contains a Date object: eval("var mydate = new Date();"); The code passed to the eval method is executed in the same context as the call to the eval method.
例如
s="alert('OOOOOOOOOOOOOOOK')";
eval(s);相当于执行了 alert('OOOOOOOOOOOOOOOK')
eval(codestring)
codestring 参数是包含有效 JScript 代码的 String 对象. 这个字符串将由 JScript 分析器进行分析和执行. 说明
eval 函数允许 JScript 源代码的动态执行. 例如,下面的代码创建了一个包含 Date 对象的新变量 mydate :
eval("var mydate = new Date();");
传递给 eval 方法的代码执行时的上下文和调用 eval 方法的一样.
Evaluates JScript code.
Syntax
eval(codestring)
The codestring argument is a String object that contains valid JScript code. This string is parsed by the JScript parser and executed. Res
The eval function allows dynamic execution of JScript source code. For example, the following code creates a new variable mydate that contains a Date object:
eval("var mydate = new Date();");
The code passed to the eval method is executed in the same context as the call to the eval method.
Evaluates JScript code.
Syntax
eval(codestring)
The codestring argument is a String object that contains valid JScript code. This string is parsed by the JScript parser and executed. Res
The eval function allows dynamic execution of JScript source code. For example, the following code creates a new variable mydate that contains a Date object:
eval("var mydate = new Date();");
The code passed to the eval method is executed in the same context as the call to the eval method.