If you can supply the logic, it should be very simple to put it together in javascript, no need to waste server firepower on it. You don't need to go back to the server for anything.
In fact (clickety-click) the site you link to does just that. Just click on "view source" on that page, and the whole thing is layed out for you..