<SCRIPT>
function calculate(form)
{
form.results.value = eval(form.entry.value);
}
</SCRIPT>
<FORM>
Enter a JavaScript mathematical expression:
<INPUT
TYPE="text"
NAME="entry"
VALUE="4*8">
The result of this expression is:
<INPUT
TYPE="text"
NAME="results"
onFocus="this.blur();">
<INPUT
TYPE="button"
VALUE="Calculate"
onClick="calculate(this.form);">
</FORM>
See what happens when you try to change the
"result" text field. blur()
won't allow you to change the value. |