[displayAll]The first part of the program clears the web page using the CLS statement. Then it adds labels and entry fields using the PRINT and TEXTBOX statements.
cls
print "Hypotenuse Calculator"
print "Length of side A: ";
textbox #sideA, a
print "Length of side B: ";
textbox #sideB, b
button #go, "Go!", [go]
if c > 0 then print "Length of side C: "; c
wait
[go]
a = #sideA value()
b = #sideB value()
c = sqr(a^2+b^2)
goto [displayAll]
Then the BUTTON statement adds a button that will use the code at the [go] label to compute the length of the C side.
Notice the IF THEN statement after the BUTTON statment. If the length of C is greater than zero then that means we have computed at least once, so print the result on the web page.
No comments:
Post a Comment