The Eval Function

Adds $5.00 to the amount you enter below:

WITHOUT the EVAL function, the + operator would concatenate the strings, not add them together.

SOURCE CODE:
<html><head>
<title>eval</title>
</head>
<body>
<h2>The Eval Function</h2>
Adds $5.00 to the amount you enter below:<br>
<form method="post" name="form" action="javascript:void(0);">
<input type="text" name="txtQ" size="20">
<input type="submit" value="Submit"
name="btnSubmit" onClick="calcTotal();">
</form>
<script language="javascript">
function calcTotal(){
   var strQ;
   var strT;
   strQ= document.form.txtQ.value;
   strT = eval(strQ);
   document.write("Your total cost is : $ ");
   document.write(strT + 5.00);
}
</script>
</body></html>