在我们的网站上,我们有一个页面可以将内容从另一个位置提取到 iFrame 中。我想知道如何创建指向父页面的链接并在 iFrame 中加载特定页面。
所以,我想创建一个链接http://xxx.xxx.com/page http://xxx.xxx.com/page并加载该页面上的 iFramehttp://yyy.xxx.com/anotherpage http://yyy.xxx.com/anotherpage
您应该为 iframe 元素指定一个名称属性,然后在锚标记中定位该名称。
Like so:
<iframe src="iframe.htm" name="iframe_a"></iframe>
<a href="http://www.urltowebsite.com" target="iframe_a">My link</a>
Fiddle http://jsfiddle.net/Sfpja/
See MDN 文档 https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe了解更多信息。
希望能帮助到你!
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)