How do I get links that are AJAXy to replace the content inside an iFrame?
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']
精彩评论