js5.htm SOURCE More on Object Properties


This is field t1. Type an arithmetic expression and click outside the field. The result will appear in t2.

This is field t2. Type an arithmetic expression and click outside the field. The result will appear in t1.



The javascript in the HEAD of this document.

<SCRIPT>

function calculate(x){
return eval(x)
}

</SCRIPT>

The function calculate gets called by the "onChange" handler in the INPUT element:

<INPUT TYPE="text" NAME="t1" VALUE="" SIZE="30" onChange=document.f1.t2.value=calculate(this.value)>