Here's a link that might help.
http://www.w3schools.com/howto/howto_js_tabs.aspYou can set up something similar to this in Quickbase. My recommendation is to move out of the formula-text fields for your code as quickly as possible and use db pages instead for your html, css, and javascript. That will substantially improve the readability of the code.
Now here's the awesome part, each form section comes with it's own id. You can use that id in place of the id in the example of the link I provided.
If you want I can write you a formula-text field that do this for any form where the field is included.