|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
DesignMode doesn't work with generated iframe in mozilla
can anybody help me to make this work with mozilla ?
function createIframe() { // creates the iframe var iframe=document.createElement("iframe"); iframe.setAttribute("id","myiframe"); iframe.setAttribute("width",750); iframe.setAttribute("height",400); iframe.setAttribute("frameborder",1); document.body.appendChild(iframe); // set designMode document.getElementById('myiframe').contentWindow. document.designMode="on"; document.getElementById('myiframe').contentWindow. document.close(); } |
|
#2
|
||||
|
||||
|
mozilla
Assuming the newlines between "....contentWindow." and "document...." are a product of the forum and not in your code (like the unwanted space in the code snippet below), I substituted the ".......close();" line with
Code:
try {
document.getElementById('myiframe').contentWindow. document.execCommand("undo", false, null);
} catch (e) {
alert("This demo is not supported on your level of Mozilla.");
}
|
|
#3
|
|||
|
|||
|
It doesn't work...
I tried but it doesn't work...
the strange thing is that if I create the HTML via document.write, it works correctly but if i generate the HTML it doesn't work... Another idea ? |
|
#4
|
||||
|
||||
|
I believe design mode is only supported by IE.
Mozilla has a good guide titled Converting an app using document.designMode from IE to Mozilla. Their demo works in both IE and Firefox.
__________________
Daryl's Homepage | My Blogroll | My Profile | Firefox supporter! DevArticles Forum Moderator "The net is a waste of time, and that's exactly what's right about it." -- William Gibson |
|
#5
|
|||
|
|||
|
Quote:
According to this article http://developer.apple.com/internet/webcontent/iframe.html Netscape and Firefox browsers need a moment after creating an inline frame before making its contents editable. Try this: function createIframe() { // creates the iframe var iframe=document.createElement("iframe"); iframe.setAttribute("id","myiframe"); iframe.setAttribute("width",750); iframe.setAttribute("height",400); iframe.setAttribute("frameborder",1); document.body.appendChild(iframe); // set designMode setTimeout("enable();", 10); document.getElementById('myiframe').contentWindow. document.close(); } function enable() { document.getElementById('myiframe').contentWindow. document.designMode="on"; } If that doesn't work, try extending the timeout. Hope this helps. |
![]() |
| Viewing: Dev Articles Community Forums > Programming > JavaScript Development > DesignMode doesn't work with generated iframe in mozilla |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|