См. Здесь (введите код): https://www.w3schools.com/code/tryit.asp?filename=FT3NWLA87A5A
function func(){
var url1 = document.getElementById("frame1").src;
var url2 = document.getElementById("frame2").src;
document.getElementById("frame1").src=url2;
document.getElementById("frame2").src=url1;
}
<iframe src="https://www.w3schools.com" id="frame1">
<p>Your browser does not support iframes.</p>
</iframe>
<iframe src="https://www.findertoday.com" id="frame2">
<p>Your browser does not support iframes.</p>
</iframe>
<button onclick="func()">Switch</button>