im iframe write()
jonny_w
- javascript
hallo forum ... ich habe ein problem ... in einer html-datei ist ein div:
<div id="wysiwyg" onload="init_wysiwyg();"></div>
wenn das geladen wird, die funktion init_wysiwyg() aufgerufen die in dem div ein iframe erstellt und etwas rein schreiben soll, das klappt im ff auch astrein.
function init_wysiwyg(){
var editor = document.getElementById('wysiwyg');
var iframe = document.createElement('iframe');
if(editor != null){
iframe.setAttribute("id","iframe");
iframe.setAttribute("frameborder","1");
iframe.setAttribute("scrolling","no");
iframe.setAttribute("style","width: 100%; height: 300px;");
editor.appendChild(iframe);
ding = frames[0].document;
if(ding){
// alert(ding);
ding.body.style.margin = '0px';
ding.designMode = 'On';
with(ding){
open();
write('blubb');
close();
}
}
}
der frame wird erstell und "blubb§ steht dann auch drinn. im ie klappt das jedoch nicht ... der frame ist da, steht aber nix drin und der designMode steht auch nicht auf on ... das komische kommt aber jetzt ... wenn ich // alert(ding); einkommtiere und die seite neu lade .. macht es *pling* alertfenster kommt sagt, es ist ein objeckt und danach steht auch der text im feld und der designmode ist an ... wir kann das denn sein ?
gruesse und so