I don't really understand the question. Do you want to change a JavaScript variable? Or a variable in your web2py code? I don't think you would be able to modify a web2py variable as the result of a click. By the time the suer views your page, all the web2py code has been rendered into HTML. You'll either need to code some JavaScript or perform some sort of Ajax call back to your server.
What exactly are you trying to do?