开发者

IFrame targeting another IFrame

开发者 https://www.devze.com 2022-12-21 01:32 出处:网络
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

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 thi开发者_如何学JAVAs possible? If so how does one go about it?


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';
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号