JavaScript Reference/Javascript Methods/eval
Версия от 18:30, 25 мая 2010; (обсуждение)
"eval()" Example
<html>
<body>
<script language="javascript">
function function1(){
var fullName = "Joe";
var mySentence = eval(""My name is " + fullName;");
alert(mySentence);
}
</script>
<button onclick="function1();">Eval function</button>
</body>
</html>
"eval()" Syntax, Parameters and Note
Note:
Evaluates the string as if it were JavaScript code.
Syntax:
eval(param1)
Parameters:
param1 Required; the string to be evaluated.