请教高手,如何将变量内容插入到下面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>
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>
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
这个编辑器编辑的实际是about:blank这个页面,怎么得到它的ID?
$(IframeID).contentWindow.document.contentEditable = true;使iframe可编辑;$(IframeID).contentWindow.document.getElementsByTagName("body")[0].innerHTML = "sdfsdfsdf";
我的意思是在iframe中编辑数据库中读出的内容,这内容如何加入iframe中?
<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是干什么的?它起什么作用?