interviews.dotnetthread.com

↑ Grab this Headline Animator

Friday, January 16, 2009

Usage of JavaScript eval() Function.

The eval() function evaluates a string and executes as it is a script code.

Syntax: eval(string)

Usage Example:


<script type="text/javascript">

eval("x=10;y=20;document.write(x*y)");
document.write("<br />");

document.write(eval("2+2"));
document.write("<br />");

var x=10;
document.write(eval(x+17));
document.write("<br />");

eval("alert('Hello world')");

</script>

Submit this story to DotNetKicks

No comments:

Post a Comment

Post your comments/questions/feedback for this Article.

 

Latest Articles