Reputation: 176
I have a parent page that contains buttons. I would like to change the iframe page on a click of the main buttons.
My code is as follow for the iframe:
<iframe id="etrack_main"
src="iframe/etrack/menu.php"
frameborder="0" width="100%" scrolling="yes"
onload="resizeIframe(this); "></iframe>
The button code is as follow:
<div class="col-xs-2">
<button type="button"
class="btn btn-rounded btn-danger btn-block"
onClick="location.href='iframe/etrack/search.php'"
target="etrack_main">Client Checks
</button>
</div>
It opens the iFrame in a new page but not using the parent page
Upvotes: 0
Views: 276
Reputation: 4370
You should put the below code in place of ...location.href=...
onClick="document.getElementById('etrack_main').src='iframe/etrack/search.php'"
Upvotes: 1