If the content can be generated dynamically (CGI, PHP, etc.) then just reference different content from the url, the main page would be page.php and the iframe content would be page.php?content=frame. Then a small if statement in the page would switch what content is displayed.

However, your original post made it sound like you are limited with the technologies that you can use. Javascript is a solution, but it's a messy one, can you re-evaluate why you need to do it within a single page? It sometimes is beneficial to go back to the root of the problem.
_________________________
Mark Cushman