Your simplest answer is to use an interpreted language, server side construct or a framework. No alternative to your requested solution. Your asking html to do something it is not intended to do natively. You are also asking that the browsers support features for which they are not natively built to support without compilations, interpretations and math services built in.
Your best bet is to link in to the jquery object from google (@ around 52kbps) your not asking for alot of your users. Only other option is to use Flash which is twice the problem and 1/2 the fun.