iframe 문서 쓰기 문제

2188 단어 iframe
여기에는 niceEditor의 코드 세션이 사용됩니다.

init : function() { 
        ... ... 
        //  iframe 
        this.elmFrame = new bkElement('iframe').setAttributes({'src' : '', 'frameBorder' : 0, 'allowTransparency' : 'true', 'scrolling' : 'no'}).setStyle({height: '100px', width: '100%'}).addClass('frame').appendTo(this.elm);
        
        if(this.copyElm) { this.elmFrame.setStyle({width : (this.elm.offsetWidth-4)+'px'}); }
        
        ... ...

        // IE6 , iframe , setTimeout 。
        // 50ms , 。
        setTimeout(this.initFrame.closure(this),50);
    },
initFrame : function() {
        var fd = $BK(this.elmFrame.contentWindow.document);

        // 
        fd.designMode = "on";       
        fd.open();
        var css = this.ne.options.externalCSS;
        fd.write('<html><head>'+((css) ? '<link href="'+css+'" rel="stylesheet" type="text/css" />' : '')+'</head><body id="nicEditContent" style="margin: 0 !important; background-color: transparent !important;">'+this.initialContent+'</body></html>');
        fd.close();
        this.frameDoc = fd;

        this.frameWin = $BK(this.elmFrame.contentWindow);
        this.frameContent = $BK(this.frameWin.document.body).setStyle(this.savedStyles);
        this.instanceDoc = this.frameWin.document.defaultView;
        
        // 
        this.heightUpdate();

        // 
        this.frameDoc.addEvent('mousedown', this.selected.closureListener(this))
            .addEvent('keyup',this.heightUpdate.closureListener(this))
            .addEvent('keydown',this.keyDown.closureListener(this))
            .addEvent('keyup',this.selected.closure(this));

        // 
        this.ne.fireEvent('add',this);
}

좋은 웹페이지 즐겨찾기