如何创建页面链接并在该页面的iframe中加载特定内容 [英] How can I create a link to page and load specific content in iframe on that page
问题描述
在我们的网站上,我们有一个网页将内容从另一个位置提取到iFrame。我想知道如何创建一个链接到父页面,并在iFrame中加载特定页面。
On our website we have a page that pulls content from another location in to an iFrame. I would like to know how I can create a link to the parent page and have a specific page load in the iFrame.
所以,我想创建一个链接 http://xxx.xxx.com/page ,并让该页面上的iFrame加载 http://yyy.xxx.com/anotherpage
So, I'd like to create a link to http://xxx.xxx.com/page and have the iFrame on that page load http://yyy.xxx.com/anotherpage
提前致谢!!
推荐答案
您应该给iframe元素一个名称属性,然后将该名称定位到您的定位标记中。
You should give your iframe element a name attribute and then target that name in your anchor tag.
像这样:
Like so:
<iframe src="iframe.htm" name="iframe_a"></iframe>
<a href="http://www.urltowebsite.com" target="iframe_a">My link</a>
请参阅 MDN文档了解更多信息。
See the MDN documentation for more info.
希望它有帮助!
这篇关于如何创建页面链接并在该页面的iframe中加载特定内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!