Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2 | daniel-mar | 1 | #!/usr/bin/env ioServer |
2 | |||
3 | c := CGI clone |
||
4 | |||
5 | multiply := method(x, y, |
||
6 | x := x asNumber |
||
7 | y := y asNumber |
||
8 | return x * y |
||
9 | ) |
||
10 | |||
11 | s := Sajax clone |
||
12 | s debug_mode := 1 |
||
13 | s init |
||
14 | s export("multiply") |
||
15 | s handle_client_request |
||
16 | |||
17 | write("Content-type: text/html\n\n") |
||
18 | |||
19 | html := """ |
||
20 | <html> |
||
21 | <head> |
||
22 | <title>Multiplier</title> |
||
23 | <script>""" |
||
24 | write(html) |
||
25 | s show_javascript |
||
26 | html := """ |
||
27 | function do_multiply_cb(z) { |
||
28 | document.getElementById("z").value = z; |
||
29 | } |
||
30 | |||
31 | function do_multiply() { |
||
32 | // get the folder name |
||
33 | var x, y; |
||
34 | |||
35 | x = document.getElementById("x").value; |
||
36 | y = document.getElementById("y").value; |
||
37 | x_multiply(x, y, do_multiply_cb); |
||
38 | } |
||
39 | </script> |
||
40 | |||
41 | </head> |
||
42 | <body> |
||
43 | <input type="text" name="x" id="x" value="2" size="3"> |
||
44 | * |
||
45 | <input type="text" name="y" id="y" value="3" size="3"> |
||
46 | = |
||
47 | <input type="text" name="z" id="z" value="" size="3"> |
||
48 | <input type="button" name="check" value="Calculate" |
||
49 | onclick="do_multiply(); return false;"> |
||
50 | </body> |
||
51 | </html> |
||
52 | """ |
||
53 | write(html) |