You're missing the architecture. Html+javascript for just the UI layer.
The pixel munging is done on the server in whatever language you
please. Display of results is done by regenerating results on the
server, which the client refreshes.

The html+javascript is just used as a sort of very bare bones 2d scene
graph, like a stripped down gdi or xwindows.

In other words, very similar to google maps.

Like I said, you can think of it abstractly as a spreadsheet where the
client has all the logic for cell interdependancies, but the heavy
calculations for cell re-evaluation is done by posting and getting to
the server.