IFrame targeting another IFrame

荒凉一梦 提交于 2019-12-24 21:25:14

问题


I have a parent page containing two iframes. One holds navigation links and the other should display the information pertaining to the navigation link clicked in the first iframe. So I need to target the one iframe from within another iframe.Is this possible? If so how does one go about it?


回答1:


I figured it out. For those who want to know, you need to use javascript to access the parent document elements and change the attributes. So to answer my own question, one sets the onclick link to run the following javascript:

parent.document.getElementById('frameName').src = 'page.html';


来源:https://stackoverflow.com/questions/2334541/iframe-targeting-another-iframe

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!