问题
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.
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
Thanks in advance!!
回答1:
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>
Fiddle
See the MDN documentation for more info.
Hope it helps!
回答2:
you'd have to add an iframe to http://xxx.xxx.com/page like this:
<iframe src="http://xxx.yyy.com/anotherpage"></iframe>
来源:https://stackoverflow.com/questions/17618314/how-can-i-create-a-link-to-page-and-load-specific-content-in-iframe-on-that-page