在我们的网站上,我们有一个页面可以将内容从另一个位置提取到 iFrame 中。我想知道如何创建指向父页面的链接并在 iFrame 中加载特定页面。
所以,我想创建一个指向 http://xxx.xxx.com/page 的链接并加载该页面上的 iFrame http://yyy.xxx.com/anotherpage
最佳答案
您应该为您的 iframe 元素提供一个名称属性,然后在您的 anchor 标记中定位该名称。
像这样:
<iframe src="iframe.htm" name="iframe_a"></iframe>
<a href="http://www.urltowebsite.com" target="iframe_a">My link</a>
参见 the MDN documentation获取更多信息。
希望对您有所帮助!
关于html - 如何创建指向页面的链接并在该页面的 iframe 中加载特定内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17618314/