1 | <HTML><HEAD><TITLE>Javascript with Forms</TITLE> |
2 | <SCRIPT LANGUAGE="JavaScript" > |
3 | <!-- A Conventional comment to hide JavaScript from old browsers |
4 | function compute(form) { |
5 | if( confirm("Is this what you want?")) |
6 | form.result.value = eval(form.expr.value); |
7 | else alert("Enter a new expression then!"); } |
8 | //scriptend--> |
9 | </SCRIPT></HEAD> |
10 | <BODY><FORM> |
11 | Enter An Expression: |
12 | <INPUT TYPE="text" NAME="expr" SIZE=15> |
13 | <INPUT TYPE="button" VALUE="DoIt!" ONCLICK="compute(this.form)"> |
14 | <BR>Result: |
15 | <INPUT TYPE="text" NAME="result" SIZE=15> |
16 | <BR> |
17 | </FORM></BODY></HTML> |