J
Jan Ebbe Jensen
Hi
I have tried the following code. It works in Mozilla. In IE I'm not able to
enable DesignMode? What have I done wrong? It says that obj is undefined?
Can anyone help me please.
<html>
<head>
<script type="text/javascript">
function initRTE (html, width, height) {
this.html = html;
this.width = width;
this.height = height;
}
initRTE.prototype.makeRTE = function() {
document.writeln('<iframe src="blank.htm" id="rte1" name="rte1" width="' +
this.width + 'px" height="' + this.height + 'px"></iframe>');
alert("getElementById: " + document.getElementById('rte1'));
this.enableDesignMode("rte1", this.html);
}
initRTE.prototype.enableDesignMode = function(rte, html) {
alert("enableDesignMode getElementById: " +
document.getElementById('rte1'));
var frameHtml = "<html>\n";
frameHtml += "<head>\n";
frameHtml += "</head>\n";
frameHtml += "<body>\n";
frameHtml += html + "\n";
frameHtml += "</body>\n";
frameHtml += "</html>";
if (document.all) {
var obj = frames[rte].document;
alert("obj " + obj);
obj.open();
obj.write(frameHtml);
obj.close();
obj.designMode = "on";
} else {
try {
document.getElementById(rte).contentDocument.designMode = "on";
try {
obj =
document.getElementById(rte).contentWindow.document;
obj.open();
obj.write(frameHtml);
obj.close();
} catch (e) {
}
} catch (e) {
}
}
}
</script>
</head>
<body>
<form name="form" action="" method="get">
<script language="JavaScript" type="text/javascript">
// initRTE (html, width, height)
var rte1 = new initRTE ("Just some text....", 560, 200);
rte1.makeRTE();
</script>
</form>
</body>
</html>
Thanks for any help!
Jan Ebbe Jensen
I have tried the following code. It works in Mozilla. In IE I'm not able to
enable DesignMode? What have I done wrong? It says that obj is undefined?
Can anyone help me please.
<html>
<head>
<script type="text/javascript">
function initRTE (html, width, height) {
this.html = html;
this.width = width;
this.height = height;
}
initRTE.prototype.makeRTE = function() {
document.writeln('<iframe src="blank.htm" id="rte1" name="rte1" width="' +
this.width + 'px" height="' + this.height + 'px"></iframe>');
alert("getElementById: " + document.getElementById('rte1'));
this.enableDesignMode("rte1", this.html);
}
initRTE.prototype.enableDesignMode = function(rte, html) {
alert("enableDesignMode getElementById: " +
document.getElementById('rte1'));
var frameHtml = "<html>\n";
frameHtml += "<head>\n";
frameHtml += "</head>\n";
frameHtml += "<body>\n";
frameHtml += html + "\n";
frameHtml += "</body>\n";
frameHtml += "</html>";
if (document.all) {
var obj = frames[rte].document;
alert("obj " + obj);
obj.open();
obj.write(frameHtml);
obj.close();
obj.designMode = "on";
} else {
try {
document.getElementById(rte).contentDocument.designMode = "on";
try {
obj =
document.getElementById(rte).contentWindow.document;
obj.open();
obj.write(frameHtml);
obj.close();
} catch (e) {
}
} catch (e) {
}
}
}
</script>
</head>
<body>
<form name="form" action="" method="get">
<script language="JavaScript" type="text/javascript">
// initRTE (html, width, height)
var rte1 = new initRTE ("Just some text....", 560, 200);
rte1.makeRTE();
</script>
</form>
</body>
</html>
Thanks for any help!
Jan Ebbe Jensen