HTML-iframe要素を取得する正しい方法
849 ワード
ドメインにまたがる関連文章については、jsドメイン横断問題JavaScriptのドメイン別総括と解決方法を詳しく説明する。
一番はっきりしているjsonp What is JSONP all aboutを説明しますか?
まずテストにはサーバ環境が必要です。http://www.dyn-web.com/tutorials/iframes/refs/iframe.php#f2
iframeから父上までの方法を添付します。http://stackoverflow.com/questions/1451208/access-iframe-elements-in-javascript
エラーの方法:http://java-my-life.iteye.com/blog/1275205 ヒント:Canot read property'getElementById'of undefined
一番はっきりしているjsonp What is JSONP all aboutを説明しますか?
まずテストにはサーバ環境が必要です。http://www.dyn-web.com/tutorials/iframes/refs/iframe.php#f2
iframeから父上までの方法を添付します。http://stackoverflow.com/questions/1451208/access-iframe-elements-in-javascript
エラーの方法:http://java-my-life.iteye.com/blog/1275205 ヒント:Canot read property'getElementById'of undefined
document.getElementById('test').onload = function(){
var ifrm = document.getElementById('test');
var doc = ifrm.contentDocument.getElementById('testa');
console.log(doc)
//console.log(window.frames['test'].document.getElementById('testa')) // Uncaught TypeError: Cannot read property 'getElementById' of undefined
}