跨域相關(guān)文章
詳解js跨域問(wèn)題
JavaScript跨域總結(jié)與解決辦法
解釋最清楚的jsonp
What is JSONP all about?
首先測(cè)試需要服務(wù)器環(huán)境
http://www.dyn-web.com/tutorials/iframes/refs/iframe.php#f2
附帶由iframe到父級(jí)的方法
http://stackoverflow.com/questions/1451208/access-iframe-elements-in-javascript
錯(cuò)誤的方法:
http://java-my-life.iteye.com/blog/1275205
提示:Cannot 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')) //此方法錯(cuò)誤Uncaught TypeError: Cannot read property 'getElementById' of undefined
}