Are you using jQuery? If so, check this out! I show you two ways to place the iframe:
<script>
function myFunction() {
var r=confirm("Press a button!");
if (r==true) {
//de put it at the end of the body
$( '<iframe src="http://w3schools.com/tags/tag_div.asp" width="100%" height="100%"</iframe>' ).appendTo( "body" );
//de put it in a pre-decided container.
$( '<iframe src="http://w3schools.com/tags/tag_div.asp" width="100%" height="100%"</iframe>' ).appendTo( "#container" );
}
}
</script>
This is a much better way than just "revealing it" because you seem to WANT the user to choose to bring up the iframe... The way above is very close to what you originally tried to do. You just needed to actually insert the element into the DOM as I showed.
Good luck!
UPDATE: I also answered your much larger question ... here is a completely cleaned and working version of what you needed with seperate iframes:
http://jsfiddle.net/W2e6u
It goes like this, with the HTML in the fiddle for you to look at:
function changeContainer(uri) {
var r=confirm("Press a button!");
if (r==true) {
$( '#container' ).fadeOut('fast').remove();
$( '<iframe id="container" src="http://www.nabler.com/services/'+uri+'.asp" width="100%" height="100%"</iframe>' ).appendTo( "body" );
}
}
And an HTML button example:
<button onclick="changeContainer('campaign-analytics')">Campaign Analytics and Reporting</button>
display:noneway. The way I showed you makes sure the page is only loaded if the visitor decides to open it, and not beforehand. Thedisplay: noneway makes people angry, and it costs you server resources whether or not someone chooses to participate!