ページ内に存在する既存のiframeについては紐付けは無理ですが、スクリプトから新規作成するものについては可能なことに気が付きました。
以下がそのサンプルです。
実行画面

以下ソース
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<body> | |
<div id=div></div> | |
</body> | |
<script> | |
resizeTo(400,500) | |
onload = function(){ | |
ifrD = document.createElement('iframe') | |
document.body.insertBefore(ifrD) | |
// createElementした時点ではframesの数は変化していない。 | |
// insertBefore後にlengthが増える。 | |
ifrF = frames[frames.length-1] | |
ifrD.onreadystatechange=function(){ | |
div.innerText += '\n\n' + this.readyState + '\n' + ifrF.location | |
} | |
} | |
</script> | |
</html> |
0 件のコメント:
コメントを投稿