iframe.contentWindowオブジェクト
2006年11月19日
iframe.contentWindowオブジェクトについて調査した。
表示には、IE をお使いください。
この結果を取得するのに用いたHTML
表示には、IE をお使いください。
この結果を取得するのに用いたHTML
<textarea id="result2"></textarea>
<hr />
<span id="result"></span>
<hr />
<script type="text/javascript">
var id=0;
function obj(o,depth){
var t='';
var value;
var e;
if (depth=='------') return '';
for (value in o) {
try{
if (''+o[value]+''=='[object]') {
id++;
t+='<a href="javascript: Open/Close" onclick="document.getElementById(\''+id+'\').style.display=(document.getElementById(\''+id+'\').style.display==\'block\')?\'none\':\'block\'; return false;">';
}
t+=depth+value+'('+((o[value]+'').substring(0,16)).substring(0,16).replace(/</,'<')+')<br />\n';
if (''+o[value]+''!='[object]') continue;
t+='</a>\n';
if (depth!='' && (''+value+''=='self' || ''+value+''=='parent' || ''+value+''=='top'|| ''+value+''=='document')) {
t+='<span id="'+id+'" style="display:none;">'+depth+'--data not shown</span>\n';
continue;
}
t+='<span id="'+id+'" style="display:none;">';
t+=obj(o[value],depth+'--');
t+='</span>\n';
}catch(e){}
}
return t;
}
function test(o){
var t=obj(o,'');
document.getElementById('result').innerHTML=t;
document.getElementById('result2').value=t;
}
</script>
<iframe src="http://localhost/" width="750"height="600"
onload="test(this.contentWindow);"
></iframe>