我希望在页面中创建一个链接或按钮来更改 iframe 所在的页面。这将是一个本地页面:
idreesinc.com/iframe.html
你可以看到我已经在这里:
idreesinc.com/research
帮助将不胜感激,因为我多年来一直在寻找答案。谢谢!
我希望在页面中创建一个链接或按钮来更改 iframe 所在的页面。这将是一个本地页面:
idreesinc.com/iframe.html
你可以看到我已经在这里:
idreesinc.com/research
帮助将不胜感激,因为我多年来一直在寻找答案。谢谢!
You can simply make an link with its target to the iframe name as follows:
<iframe name="demo" src="example.php"></iframe>
Your link in the parent will be:
<a href="newpage.html" target="demo">Change Link</a>
<script>
function setURL(url){
document.getElementById('iframe').src = url;
}
</script>
<iframe id="iframe" src="idreesinc.com/research.html" />
<input type="button" onclick="setURL('URLHere')" />
Create a button inside a link with its target pointing to the iframe name:
<iframe name="demo" src="site1.html"></iframe>
<a href="site2.html" target="demo"><button>site2</button></a>