editable iframe on the fly

S

sahista

Hello.

I create an iframe on the fly, set it to editable designMode='on' and
insert into iframe.contentWindow.childNodes[0].childNodes[1] some
innerHTML.
Ok... that all works fine in IE but in firefox it wont became editable
neither insert the innerHTML!?
I tried also set the onreadystatechange on iframe to for making it
editable and set the innerHTML into contentWindow..nothing...
any suggestion appreciated!
thanx in advance
 
S

Stevo

sahista said:
Hello.
I create an iframe on the fly, set it to editable designMode='on' and
insert into iframe.contentWindow.childNodes[0].childNodes[1] some
innerHTML.
Ok... that all works fine in IE but in firefox it wont became editable
neither insert the innerHTML!?

Well I for one am intrigued. What's this designmode and setting an
iframe to editable all about? I've never needed to set anything to be
editable to write to innerHTML. I expect I'm about to learn something
here :)
 
S

sahista

sahista said:
Hello.
I create an iframe on the fly, set it to editable designMode='on' and
insert into iframe.contentWindow.childNodes[0].childNodes[1] some
innerHTML.
Ok... that all works fine in IE but in firefox it wont became editable
neither insert the innerHTML!?

Well I for one am intrigued. What's this designmode and setting an
iframe to editable all about? I've never needed to set anything to be
editable to write to innerHTML. I expect I'm about to learn something
here :)

ok...
this is the code
HTML:
<html>
<head>
<script type="text/javascript" language="javascript">
window.onload = function() {
var iFrm =
document.createElement("IFRAME"), aIF;
with(iFrm) {
scrolling = "yes";
frameborder = 0;
width = 300;
height = 200;
}

document.getElementsByTagName("BODY")[0].appendChild(iFrm);
aIF = iFrm.contentWindow.document
|| iFrm.contentDocument.document;
aIF.onreadystatechange =
setEditable;
}
function setEditable() {
if(this.readyState == "complete") {
this.designMode =
"on";;
}
}
</script>
</head>
<body>
</body>
</html>
this works in IE but not in firefox!
in firefox the onreadystatechange property is ignored!!??
and the question is how to insert some HTML code into the iframe
document after it became editable..
any suggestion appreciated..
thanx in advance
 
S

sahista

sahista said:
Hello.
I create an iframe on the fly, set it to editable designMode='on' and
insert into iframe.contentWindow.childNodes[0].childNodes[1] some
innerHTML.
Ok... that all works fine in IE but in firefox it wont became editable
neither insert the innerHTML!?
Well I for one am intrigued. What's this designmode and setting an
iframe to editable all about? I've never needed to set anything to be
editable to write to innerHTML. I expect I'm about to learn something
here :)

ok...
this is the code
HTML:
<html>
<head>
<script type="text/javascript" language="javascript">
window.onload = function() {
var iFrm =
document.createElement("IFRAME"), aIF;
with(iFrm) {
scrolling = "yes";
frameborder = 0;
width = 300;
height = 200;
}

document.getElementsByTagName("BODY")[0].appendChild(iFrm);
aIF = iFrm.contentWindow.document
|| iFrm.contentDocument.document;
aIF.onreadystatechange =
setEditable;
}
function setEditable() {
if(this.readyState == "complete") {
this.designMode =
"on";;
}
}
</script>
</head>
<body>
</body>
</html>
this works in IE but not in firefox!
in firefox the onreadystatechange property is ignored!!??
and the question is how to insert some HTML code into the iframe
document after it became editable..
any suggestion appreciated..
thanx in advance

solved on window.setTimeout but its not that object oriented that i
wanted with onreadystatechange but it seems firefox doesnt understand
it when the property is used on iframe...
hth
<html>
<head>
<script type="text/javascript" language="javascript">
window.onload = function() {
var iFrm =
document.createElement("IFRAME"), aIF;
with(iFrm) {
scrolling = "yes";
frameborder = 0;
width = 300;
height = 200;
id = "edit_ifr";
}

document.getElementsByTagName("BODY")[0].appendChild(iFrm);
window.setTimeout("setEditable('"
+ iFrm.id + "')", 100);
}
function setEditable() {
var iFrDoc =
document.getElementById(arguments[0]).contentWindow.document ||

document.getElementById(arguments[0]).contentDocument.document;
if(!document.all) {
iFrDoc.body.innerHTML
= "testiram";
iFrDoc.designMode =
"on";
} else {
iFrDoc.body.innerHTML =
"testiram";
iFrDoc.body.contentEditable =
true;
}
}
</script>
</head>
<body>
</body>
</html>
 
T

Thomas 'PointedEars' Lahn

sahista said:
solved on window.setTimeout but its not that object oriented that i
wanted

Do you know that window.setTimeout() can take a Function object reference as
first argument long since?
with onreadystatechange but it seems firefox doesnt understand
it when the property is used on iframe...

Firefox is not supposed to support MSHTML-proprietary features, despite some
recent evidence to the contrary.


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top