I want to load an HTML page into an iFrame with JS instead of using the usual iFrame target. Long story. That's just how I need it to be. My Javscript is
onclick = function buttonLife() {
var el=document.getElementById("divContent");
el.innerHTML="<iframe width=1024 height=702 scrolling=no name=bottomFrame frameborder=0 src=page.html></iframe>";
}
And my HTML is:
<a href="#" onclick="buttonLife();">BUTTON</a>;
And it works. But it loads a page already defined by the above java function. However, if I want to make the page I load into the iFrame variable for each button with the following HTML:
<a href="#" onclick="buttonLife('page2.html');">BUTTON2</a>
I know I need to change the have function to something like
onclick = function buttonLife() {
var el=document.getElementById("divContent");
el.innerHTML="<iframe width=1024 height=702 scrolling=no name=bottomFrame frameborder=0 src='link'></iframe>";
}
But it doesn't work. Help! Thanks