어제인가... http://club.cyworld.com/devsquare 에 플래시와 관련한(?) z-index 에 관련한 이야기가 나와서
그에 대한 답변으로 iframe 을 언급해보긴 했는데...
... 사실 iframe 을 다루는 것이 그리 만만한 것이 아니었다.
일단, 이번에 서술할 내용은 iframe 을 열고, 그 iframe 을 살짝이나마 다루는 내용.
...
<script>
var framename='abcdefg', framename2='hijklmn';
document.write('<iframe name='+framename+' width=100 height=100 ></iframe>'+framename+'<br>');
document.write('<iframe name='+framename2+' width=100 height=100 ></iframe>'
+'<input type=button value='+framename2+' onclick=iframecatch2();><br>');
function iframecatch() {
frames.window[framename].document.open();
frames.window[framename].document.write('abc');
frames.window[framename].document.close();
}
function iframecatch2() {
document.getElementById(framename2).document.open();
document.getElementById(framename2).document.write('abc');
document.getElementById(framename2).document.close();
}
</script>
...
...
abcdefg 를 클릭해서 iframe 내부내용을 컨트롤 할 수 있었지만,
hijklmn 을 클릭하면 document.getElementById() 형식으로 iframe 이 존재한다는 것은 알 수 있어도
frame 자체를 컨트롤 할 수는 없다.
오히려 기존 컨트롤을 하는 주체 document 가 망가지는 형태를 띄게 되는 것.
...
OTL... 이 사실을 알아내기까지 너무 오래걸렸...
예전 같으면 frame1=window.open('http://',framename) 형식으로 받아서 썼을텐데,
지금은 http:// 에 관련해서 뭔가 불안한 모습이 보여, 결국 이런 방식을 채택(?)했다.
NowMark killofki@.
'document .write()' 카테고리의 다른 글
document.write...를 간편하게 쓰기위해 함수... (2) | 2009.08.28 |
---|---|
javascript 의 시작...? document.write(''); (0) | 2009.08.28 |