请教高手,如何将变量内容插入到下面IFRAME里面(不改动src="about:blank")?<SCRIPT LANGUAGE="JavaScript">
if(document.all){
document.write('<IFRAME class="HtmlEditor" ID="HtmlEditor" name="HtmlEditor" style="height:246px;width:100%;background:#fff;" frameBorder="0" marginHeight=0 marginWidth=0 src="about:blank" onload=SetDiv()></IFRAME>');
}else{
document.write('<IFRAME class="HtmlEditor" ID="HtmlEditor" name="HtmlEditor" style="height:252px;width:100%;background:#fff;" frameBorder="0" marginHeight=0 marginWidth=0 src="about:blank" onload=SetDiv()></IFRAME>');
}
if(document.all){
document.write('<textarea ID="sourceEditor" style="height:246px;width:100%;marign:0;padding:0;font:normal 12px Tahoma;display:none;word-break:break-all;border:none;background:#fff;" onpropertychange="try{parent.SourceEditor_PropertyChange();}catch(e){}"></textarea>');
}else{
document.write('<textarea ID="sourceEditor" style="height:246px;width:100%;marign:0;padding:0;font:normal 12px Tahoma;display:none;word-break:break-all;border:none;background:#fff;" onpropertychange="try{parent.SourceEditor_PropertyChange();}catch(e){}"></textarea>');
}
</SCRIPT>

解决方案 »

  1.   

    在写入了
    document.write('<textarea ID="sourceEditor" style="height:246px;width:100%;marign:0;padding:0;font:normal 12px Tahoma;display:none;word-break:break-all;border:none;background:#fff;" onpropertychange="try{parent.SourceEditor_PropertyChange();}catch(e){}"></textarea>');
    }
    </SCRIPT>
    之后可以通过这个id得到iframe中的这个对象,然后再write
      

  2.   


    这个编辑器编辑的实际是about:blank这个页面,怎么得到它的ID?
      

  3.   

    $(IframeID).contentWindow.document.designMode="on";
    $(IframeID).contentWindow.document.contentEditable = true;使iframe可编辑;$(IframeID).contentWindow.document.getElementsByTagName("body")[0].innerHTML = "sdfsdfsdf";
      

  4.   


    我的意思是在iframe中编辑数据库中读出的内容,这内容如何加入iframe中?
      

  5.   

    你是要做HTMLEditor?不是一样,你goole一下富文本原理,研究一下吧!
      

  6.   

    在iframe中编辑数据库中读出的内容,这内容如何加入iframe中?
      

  7.   


    <SCRIPT LANGUAGE="JavaScript">
    if(document.all){
        document.write('<IFRAME class="HtmlEditor" ID="HtmlEditor" name="HtmlEditor" style="height:246px;width:100%;background:#fff;" frameBorder="0" marginHeight=0 marginWidth=0 src="about:blank" onload=SetDiv()></IFRAME>');
    }else{
        document.write('<IFRAME class="HtmlEditor" ID="HtmlEditor" name="HtmlEditor" style="height:252px;width:100%;background:#fff;" frameBorder="0" marginHeight=0 marginWidth=0 src="about:blank" onload=SetDiv()></IFRAME>');
    }
    if(document.all){
        document.write('<textarea ID="sourceEditor" style="height:246px;width:100%;marign:0;padding:0;font:normal 12px Tahoma;display:none;word-break:break-all;border:none;background:#fff;" onpropertychange="try{parent.SourceEditor_PropertyChange();}catch(e){}"></textarea>');
    }else{
        document.write('<textarea ID="sourceEditor" style="height:246px;width:100%;marign:0;padding:0;font:normal 12px Tahoma;display:none;word-break:break-all;border:none;background:#fff;" onpropertychange="try{parent.SourceEditor_PropertyChange();}catch(e){}"></textarea>');
    }
    </SCRIPT>你告诉我,你页面上写一个iframe后,再写一个textarea是干什么的?它起什么作用?
      

  8.   

    这是163.com提供的163htmledit的程序,我就是搞不明白.