js6a.htm SOURCE The Math Object with Comments


This is text field t1. This will be the input field.
Type a number into this field.

This is text field t2. This will be the output field.

These buttons will display F(t1) as an English sentence in t2. F = name of the button.


The script in the header defines some text globals which are used by the handlers

<SCRIPT>
var SQ ="The square root of "
var SI = "The sine of "
var EQ =" equals "
var REQ =" radians equals "
</SCRIPT>

The button handlers

<INPUT TYPE=button NAME="SQRT" VALUE="SQRT" onClick=document.f1.t2.value=SQ+document.f1.t1.value+EQ+Math.sqrt(document.f1.t1 .value)>
<INPUT TYPE=button NAME="SIN" VALUE="SIN" onClick=document.f1.t2.value=SI+document.f1.t1.value+REQ+Math.sin(document.f1.t1 .value)>