The Eval function will use obj as code to execute it again, here is an example for you to introduce the specific method of using, interested friends can refer to ha, I hope to help you
eval (obj); The function executes obj as code.
Example:
Copy Code code as follows:
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<meta http-equiv=" Content-type " Content= "text/html; Charset=utf-8 "/>
<script src=" jquery-1.2.6.js "></script>
<title> eval function Use </title& Gt
<script>
Function But1_click () {
var obj = $ ("#test");
Alert (Obj.val ());
Eval (Obj.val ());//Obj.val () will be executed as code
</script>
<body>
<textarea id= "Test" cols= "rows=" >
var a = 3;
var b = 5;
var C = a + B;
Alert (c);
</textarea>
<input type= "button" id= "BUT1" value= "Execute" onclick= "But1_click ()"/>
</body>