August 1999
Intermediate to advanced
1488 pages
72h 53m
English
object.eval(string)
The eval() method of the Object object evaluates a string of JavaScript code in reference to this object.
Listing 6.193 shows how the eval() method is used. Two variables are declared and set. A statement multiplying the two variables together is passed to the eval() method to be evaluated.
<html>
<body>
<script language="JavaScript">
<!––Hide
var x = 9;
var y = 8;
document.write("The result of x * y is: " + eval(x * y));
// End Hide ––>
</script>
</body>
</html>
|
Read now
Unlock full access