开发者

How do I get links that are AJAXy to replace the content inside an iFrame?

开发者 https://www.devze.com 2023-04-09 23:52 出处:网络
So, I added to my AJAX links the name of the iframe, target=\"name\", but I think I might be erroring on the replacing part...

So, I added to my AJAX links the name of the iframe, target="name", but I think I might be erroring on the replacing part...

page.replace_html("section-content",:partial=>"/path/contents/edit",:object=>@content)

yeah, it's RoR, but that's not important... I think my selector isn't being found because that div is now in an iframe.

How to I select elements in an iframe?

开发者_如何学JAVAI've tried window.frames['name'].document but I just get a document object that seems to have no methods.


window.frames['name'].contentDocument.document

Note: You must obey the same-origin policy.

For IE7 and lower, use:

window.frames['name'].contentWindow.document

P.S., you can use document.getElementById('id') instead of window.frames['name']

0

精彩评论

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

关注公众号