Can you elaborate what you did, what you thought would happen, and what actually happened?
Defining a global variable, e.g. in the top-level window, and setting that through a JavaScript function from the various frames whenever a button is clicked, would seem to be the way to go.
This is not a
JSP question, though, but HTML and/or JavaScript. Or are you trying to keep track on the server side?